Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): add tests/ gift card API/ multiple fixes #1470

Open
wants to merge 72 commits into
base: master
Choose a base branch
from

Conversation

pcriadoperez
Copy link
Collaborator

@pcriadoperez pcriadoperez commented Nov 13, 2024

Dependent on PR #1464

  • Adds tests. By default does not run margin or portfolio or private options tests. (Can activate with flag --run-margin and --run-portfolio) (This endpoints as are live were not tested)
  • Adds missing endpoint for futures_edit_order
  • Fixes error for some get requests missing ContentType in the header for async requests
  • Fix batch orders async call
  • Requires to whitelist eapi.binance.com in the proxy
  • Add pytest-xdist to run tests in parallel
  • Adds gift card api
  • activate ruff format
  • add missing futures_modify_order from async client

@pcriadoperez pcriadoperez marked this pull request as ready for review November 19, 2024 04:15
@coveralls
Copy link

coveralls commented Nov 19, 2024

Coverage Status

coverage: 67.1% (+5.8%) from 61.304%
when pulling 8892429 on pcriadoperez:all-tests
into 3deccc5 on sammchardy:master.

@carlosmiei carlosmiei changed the title Add tests feat(client): add tests/ gift card API/ multiple fixes Nov 21, 2024
@@ -206,6 +206,7 @@ def __init__(
def _get_headers(self) -> Dict:
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting at ccxt we're using 'Content-Type': 'application/x-www-form-urlencoded',

@carlosmiei
Copy link
Collaborator

DEMO swap

python examples/create_order_async.py
{'orderId': 4067449380, 'symbol': 'BTCUSDT', 'status': 'NEW', 'clientOrderId': 'x-Cb7ytekJ37b8cfbafacdfa36cd379', 'price': '0.00', 'avgPrice': '0.00', 'origQty': '0.010', 'executedQty': '0.000', 'cumQty': '0.000', 'cumQuote': '0.00000', 'timeInForce': 'GTC', 'type': 'MARKET', 'reduceOnly': True, 'closePosition': False, 'side': 'SELL', 'positionSide': 'LONG', 'stopPrice': '0.00', 'workingType': 'CONTRACT_PRICE', 'priceProtect': False, 'origType': 'MARKET', 'priceMatch': 'NONE', 'selfTradePreventionMode': 'NONE', 'goodTillDate': 0, 'updateTime': 1732204122751}
{'orderId': 4067449380, 'symbol': 'BTCUSDT', 'status': 'FILLED', 'clientOrderId': 'x-Cb7ytekJ37b8cfbafacdfa36cd379', 'price': '0.00', 'avgPrice': '99971.20000', 'origQty': '0.010', 'executedQty': '0.010', 'cumQuote': '999.71200', 'timeInForce': 'GTC', 'type': 'MARKET', 'reduceOnly': True, 'closePosition': False, 'side': 'SELL', 'positionSide': 'LONG', 'stopPrice': '0.00', 'workingType': 'CONTRACT_PRICE', 'priceProtect': False, 'origType': 'MARKET', 'priceMatch': 'NONE', 'selfTradePreventionMode': 'NONE', 'goodTillDate': 0, 'time': 1732204122751, 'updateTime': 1732204122751}
[{'symbol': 'LTCUSDT', 'positionSide': 'LONG', 'positionAmt': '3.300', 'entryPrice': '78.63030303029', 'breakEvenPrice': '78.65361575758', 'markPrice': '88.28000000', 'unRealizedProfit': '31.84400000', 'liquidationPrice': '0', 'isolatedMargin': '0', 'notional': '291.32400000', 'marginAsset': 'USDT', 'isolatedWallet': '0', 'initialMargin': '29.13240000', 'maintMargin': '1.89360600', 'positionInitialMargin': '29.13240000', 'openOrderInitialMargin': '0', 'adl': 0, 'bidNotional': '0', 'askNotional': '0', 'updateTime': 1732119287099}, {'symbol': 'BTCUSDT', 'positionSide': 'LONG', 'positionAmt': '0.015', 'entryPrice': '79888.804', 'breakEvenPrice': '66580.45818932', 'markPrice': '96489.20000000', 'unRealizedProfit': '249.00594000', 'liquidationPrice': '0', 'isolatedMargin': '0', 'notional': '1447.33800000', 'marginAsset': 'USDT', 'isolatedWallet': '0', 'initialMargin': '289.46760000', 'maintMargin': '5.78935200', 'positionInitialMargin': '289.46760000', 'openOrderInitialMargin': '0', 'adl': 0, 'bidNotional': '0', 'askNotional': '0', 'updateTime': 1732204122751}]
[{'accountAlias': 'AuoCAuuXmYFz', 'asset': 'FDUSD', 'balance': '0.00000000', 'crossWalletBalance': '0.00000000', 'crossUnPnl': '0.00000000', 'availableBalance': '0.00000000', 'maxWithdrawAmount': '0.00000000', 'marginAvailable': True, 'updateTime': 0}, {'accountAlias': 'AuoCAuuXmYFz', 'asset': 'BTC', 'balance': '0.00000000', 'crossWalletBalance': '0.00000000', 'crossUnPnl': '0.00000000', 'availableBalance': '0.00000000', 'maxWithdrawAmount': '0.00000000', 'marginAvailable': True, 'updateTime': 0}, {'accountAlias': 'AuoCAuuXmYFz', 'asset': 'BNB', 'balance': '0.00000000', 'crossWalletBalance': '0.00000000', 'crossUnPnl': '0.00000000', 'availableBalance': '0.00000000', 'maxWithdrawAmount': '0.00000000', 'marginAvailable': True, 'updateTime': 0}, {'accountAlias': 'AuoCAuuXmYFz', 'asset': 'ETH', 'balance': '0.00000000', 'crossWalletBalance': '0.00000000', 'crossUnPnl': '0.00000000', 'availableBalance': '0.00000000', 'maxWithdrawAmount': '0.00000000', 'marginAvailable': True, 'updateTime': 0}, {'accountAlias': 'AuoCAuuXmYFz', 'asset': 'USDT', 'balance': '4517.42752243', 'crossWalletBalance': '4517.42752243', 'crossUnPnl': '280.84994000', 'availableBalance': '4475.45346243', 'maxWithdrawAmount': '4475.45346243', 'marginAvailable': True,

DEMO Spot

{'symbol': 'BTCUSDT', 'orderId': 6441767, 'orderListId': -1, 'clientOrderId': 'x-HNA2TXFJ969f76bc7d0b68c0a2076d', 'transactTime': 1732204206772, 'price': '0.00000000', 'origQty': '0.01000000', 'executedQty': '0.01000000', 'cummulativeQuoteQty': '961.93960000', 'status': 'FILLED', 'timeInForce': 'GTC', 'type': 'MARKET', 'side': 'SELL', 'workingTime': 1732204206772, 'fills': [{'price': '96193.96000000', 'qty': '0.01000000', 'commission': '0.00000000', 'commissionAsset': 'USDT', 'tradeId': 2320696}], 'selfTradePreventionMode': 'EXPIRE_MAKER'}
{'symbol': 'BTCUSDT', 'orderId': 6441767, 'orderListId': -1, 'clientOrderId': 'x-HNA2TXFJ969f76bc7d0b68c0a2076d', 'price': '0.00000000', 'origQty': '0.01000000', 'executedQty': '0.01000000', 'cummulativeQuoteQty': '961.93960000', 'status': 'FILLED', 'timeInForce': 'GTC', 'type': 'MARKET', 'side': 'SELL', 'stopPrice': '0.00000000', 'icebergQty': '0.00000000', 'time': 1732204206772, 'updateTime': 1732204206772, 'isWorking': True, 'workingTime': 1732204206772, 'origQuoteOrderQty': '0.00000000', 'selfTradePreventionMode': 'EXPIRE_MAKER'}
{'asset': 'USDT', 'free': '10854.94831000', 'locked': '0.00000000'}
(.binance) ➜  python-binance git:(all-tests) ✗ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants