Open celltronic01 opened 3 years ago
`def update_portfolio(orders): for coin in orders: if orders[coin]['status'] == 'FILLED' and float(orders[coin]['executedQty']) > 0: buy_price = float(orders[coin]['cummulativeQuoteQty']) / float(orders[coin]['executedQty']) else: buy_price = 0 # En caso de que no se ejecute ninguna parte de la orden
volume = float(orders[coin]['executedQty'])
coins_bought[coin] = {
'symbol': orders[coin]['symbol'],
'orderid': orders[coin]['orderId'],
'timestamp': orders[coin]['time'],
'bought_at': buy_price,
'volume': volume,
'stop_loss': -STOP_LOSS,
'take_profit': TAKE_PROFIT,
'buy_price': buy_price,
}
with open(coins_bought_file_path, 'w') as file:
json.dump(coins_bought, file, indent=4)
print(f'Orden con id {orders[coin]["orderId"]} actualizada y guardada en el archivo')`
Hi, I have an issue or 2. Please, if someone could look into this for me. Not a Python Savvy here.