Ktx main#135
Open
ceze wants to merge 28 commits into
Open
Conversation
added 28 commits
May 27, 2026 11:53
… KTX market data (no CCXT fallback)
Covers: - Symbol normalization (to_ktx_symbol) - Client initialization & validation - Numeric helpers (Decimal, step floor, precision) - Authentication & signing (HMAC-SHA256, raw body) - Market data endpoints (products, ticker, ping) - Account endpoints (balance, positions) - Order lifecycle (place market/limit, get, cancel, open orders) - wait_for_fill polling - set_leverage - get_fee_rate Note: Tests bypass Flask dependency by loading modules directly.
…rade_balance - get_account() now uses /v1/main/accounts (wallet/main account) - New get_trade_balance(asset?) uses /v1/trade/accounts (futures collateral) - get_positions() now calls get_trade_balance() internally - Add real API tests for trade balance (all assets + single asset) - Total 38 tests passing
- get_positions(position_id?, market?, symbol?) now calls /v1/positions - market defaults to 'lpc' for swap market_type - symbol defaults to all symbols (no filter) - Add real API test for single-symbol position query - 39 tests passing
…slots - Always set market=lpc when no explicit market given (prevents returning all markets) - Filter out closed position slots where quantity=0 (KTX returns empty shells after close) - Now correctly returns 1 real BTC position (0.000972 BTC, long, entry 79036.5) - 39 tests passing
…ints, POST main/accounts
KTX is a unified account: spot + futures assets together.
- market param now required on all order-related methods (spot=lpc required)
- Add get_spot_balance() using POST /v1/main/accounts (wallet account)
- Add spot_transfer() for WALLET_TRADE / TRADE_WALLET transfers
- Add get_ledger() for bill records (transfers, trades, fees, funding)
- Add get_history_orders() for settled/filled/cancelled orders
- Fix get_open_orders() -> /v1/pending/orders (was /v1/orders)
- Fix cancel_order() -> /v1/order/delete (was DELETE /v1/orders/{id})
- Fix get_order() -> /v1/order?id={id} (was /v1/orders/{id})
- Fix set_leverage() -> /v1/change/leverage (was /v1/trade/leverage)
- Fix POST body: empty body sends {} instead of Invalid JSON error
- 42 tests passing
- KTX unified account: spot+futures assets are in /v1/trade/accounts (trade account) - get_spot_balance() -> alias for get_trade_balance() (trade account) - get_wallet_balance() -> uses POST /v1/main/accounts (separate wallet) - get_account() -> calls get_wallet_balance() - 43 tests passing
- Account system: wallet account (/v1/main/accounts) vs trade account (/v1/trade/accounts) - market parameter: spot/lpc required on all order endpoints - Account field semantics: withdrawable=实际可用, locked=挂单冻结 - All API methods with correct endpoints - Known bugs and fix history - Test suite: 43 tests passing
* commit '7aad07280f499c8460e98a14d1a845bc1618b476': v3.0.22 chore: update repo traffic metrics [skip ci] v3.0.22 Signed-off-by: Dinger <quantdinger@gmail.com> chore: update repo traffic metrics [skip ci] v3.0.22 v3.0.22 v3.0.22 v3.0.21 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.20 v3.0.19 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.18 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.17 v3.0.17 v3.0.17 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.17 输出用户自定义日志,方便策略跟踪
* main: v3.0.26 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.25 v3.0.24 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.24 v3.0.22 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.22 Signed-off-by: Dinger <quantdinger@gmail.com> v3.0.22 Signed-off-by: Dinger <quantdinger@gmail.com>
* main: feat: add LiteLLM to settings UI dropdown feat: add LiteLLM as unified LLM provider v3.0.29 # Conflicts: # backend_api_python/app/routes/credentials.py # backend_api_python/app/services/broker_market_policy.py # backend_api_python/app/services/exchange_execution.py # backend_api_python/app/services/live_trading/execution.py # backend_api_python/app/services/live_trading/factory.py # backend_api_python/app/services/pending_order_worker.py # backend_api_python/app/services/strategy.py
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add integration for KTX Crypto Exchange.
Changes
move config file .env to ./configs/.env
Test plan
docker compose up -d --buildAPI documentation (if routes/schemas changed)
docs/api/openapi.yaml(cd backend_api_python && python scripts/export_openapi.py)docs/agent/agent-openapi.jsonif/api/agent/v1routes changedScreenshots (if UI change)