Created
May 6, 2023 08:24
-
-
Save under0tech/68879f0ee01b9c1c70b08ca5beaac437 to your computer and use it in GitHub Desktop.
This file contains 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
# TRADING | |
def trade(api, stock, operation, shares_to_trade, take_profit, stop_loss): | |
api.submit_order(symbol = stock, qty = shares_to_trade, side = operation, type = 'market', | |
order_class = 'bracket', time_in_force = 'day', | |
take_profit = {'limit_price': take_profit}, | |
stop_loss = {'stop_price': stop_loss}) | |
message = f'\n\t*{stock}*, qty _{shares_to_trade}_ \n\t\twere {operation}' | |
send_message(f'{TRADER_ID}: we entered the market with:' + message) | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment