Last active
November 6, 2021 03:29
-
-
Save dkav6/b1b24e4a61bc650e6b530d3415043948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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