sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
6.01k stars 2.2k forks source link

client.futures_create_order() doesn't change balance even after order is filled. #974

Open 0xYelshayeb opened 3 years ago

0xYelshayeb commented 3 years ago

I place an order on binance using the python-binance library using the following code:

from binance.client import Client
from binance.enums import *

api_key = '<api_key>'
api_secret = '<api_secret>'

def main():
    client = Client(api_key, api_secret)
    order = client.futures_create_order(
      symbol='ETHUSDT',
      side=SIDE_BUY,
      type=FUTURE_ORDER_TYPE_MARKET,
      quantity='0.01')
    print(order)

if __name__ == '__main__':
  main()

The order executes without any errors. I can also check it with the appropriate client.futues_get_open_orders() function. Though after the trade executes my balance is unchanged. Running client.futures_account_balance() gives me my initial balance again unchanged. Even after i try to cancel all open orders with client.futures_cancel_all_open_orders(**params) nothing changes. Is there something I'm missing here?

Rizhiy commented 2 years ago

Same problem, when position is opened, base coin stays the same. How do we calculate liquidation value?