Skip to content

Instantly share code, notes, and snippets.

@ugik
Created August 26, 2021 01:00
Show Gist options
  • Save ugik/02489b7d85e12e052ae16f84ed24b841 to your computer and use it in GitHub Desktop.
Save ugik/02489b7d85e12e052ae16f84ed24b841 to your computer and use it in GitHub Desktop.
def getAmountETH(positionSize, timeFrom):
checkToken()
latestPrice = CMclient.get_latest_trades(pair='ETHUSD', From=timeFrom)['tickHistory'][-1]['price']
buyAmount = float("{:.4f}".format(positionSize/latestPrice))
return latestPrice, buyAmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment