Skip to content

Instantly share code, notes, and snippets.

@dkav6
Last active November 6, 2021 03:29
Show Gist options
  • Save dkav6/b1b24e4a61bc650e6b530d3415043948 to your computer and use it in GitHub Desktop.
Save dkav6/b1b24e4a61bc650e6b530d3415043948 to your computer and use it in GitHub Desktop.
def buy_max(pair, client=client):
# Use max possible usd size
price = client.fetchTicker(pair)['last']
size = client.fetchBalance()['USD']['free'] / price
client.createMarketBuyOrder(pair, amount=size)
print(f"bought ${size} of {pair}")
def sell_max(pair, client=client):
symbol = pair.split("-")[0]
size = client.fetchBalance()[symbol]['free']
client.createMarketSellOrder(pair, amount=size)
print(f"bought ${size} of {pair}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment