@@ -175,6 +175,12 @@ import time
175175start_ts = int (time.mktime(time.strptime(" 2024-01-01" , " %Y-%m-%d " )) * 1000 )
176176end_ts = int (time.mktime(time.strptime(" 2024-01-02" , " %Y-%m-%d " )) * 1000 )
177177klines = client.market().get_klines(" BTC-USDT" , " 1h" , 100 , start_ts, end_ts)
178+
179+ # Spot klines with timezone (v2 endpoint)
180+ # time_zone: 0=UTC (default), 8=UTC+8
181+ spot_klines = client.market().get_spot_klines(
182+ " BTC-USDT" , " 1h" , 100 , start_ts, end_ts, time_zone = 8
183+ )
178184```
179185
180186#### Funding Rate, Mark Price
@@ -360,9 +366,18 @@ transfer = client.spot_account().universal_transfer(
360366
361367history = client.spot_account().get_asset_transfer_records(type_ = " FUND_PFUTURES" )
362368
369+ # Internal transfer (main account internal transfer)
370+ # wallet_type: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, 4=Spot Account
371+ # user_account_type: 1=UID, 2=Phone number, 3=Email
363372internal = client.spot_account().internal_transfer(
364- coin = " USDT" , wallet_type = " SPOT" , amount = 50.0 ,
365- transfer_type = " FROM_MAIN_TO_SUB" , sub_uid = " 123456"
373+ coin = " USDT" ,
374+ wallet_type = 4 , # Spot Account
375+ amount = 50.0 ,
376+ user_account_type = 1 , # UID
377+ user_account = " 123456" ,
378+ calling_code = None , # Required when user_account_type=2
379+ transfer_client_id = " transfer-001" , # Optional custom ID
380+ recv_window = None
366381)
367382
368383all_balances = client.spot_account().get_all_account_balances()
@@ -398,9 +413,55 @@ client.sub_account().delete_sub_account_api_key("sub_account_001", "your_api_key
398413#### Transfers
399414
400415``` python
416+ # Sub-account internal transfer
417+ # wallet_type: 1=Fund Account, 2=Standard Futures, 3=Perpetual Futures, 15=Spot Account
418+ # user_account_type: 1=UID, 2=Phone number, 3=Email
401419transfer = client.sub_account().sub_account_internal_transfer(
402- coin = " USDT" , wallet_type = " SPOT" , amount = 100.0 ,
403- transfer_type = " FROM_MAIN_TO_SUB" , to_sub_uid = " 12345678"
420+ coin = " USDT" ,
421+ wallet_type = 15 , # Spot Account
422+ amount = 100.0 ,
423+ user_account_type = 1 , # UID
424+ user_account = " 12345678" ,
425+ calling_code = None , # Required when user_account_type=2
426+ transfer_client_id = " transfer-001" , # Optional custom ID
427+ recv_window = None
428+ )
429+
430+ # Sub-Mother Account Asset Transfer (master account only)
431+ # Flexible transfer between parent and sub-accounts
432+ transfer = client.sub_account().sub_mother_account_asset_transfer(
433+ asset_name = " USDT" ,
434+ transfer_amount = 100.0 ,
435+ from_uid = 123456 ,
436+ from_type = 1 , # 1=Parent account, 2=Sub-account
437+ from_account_type = 1 , # 1=Funding, 2=Standard futures, 3=Perpetual, 15=Spot
438+ to_uid = 789012 ,
439+ to_type = 2 , # 1=Parent account, 2=Sub-account
440+ to_account_type = 15 , # Spot account
441+ remark = " Transfer to sub-account" ,
442+ recv_window = None
443+ )
444+
445+ # Query transferable amount (master account only)
446+ transferable = client.sub_account().get_sub_mother_account_transferable_amount(
447+ from_uid = 123456 ,
448+ from_account_type = 1 , # Funding
449+ to_uid = 789012 ,
450+ to_account_type = 15 , # Spot
451+ recv_window = None
452+ )
453+
454+ # Query transfer history (master account only)
455+ import time
456+ history = client.sub_account().get_sub_mother_account_transfer_history(
457+ uid = 123456 ,
458+ type_ = None , # Optional filter
459+ tran_id = None , # Optional filter
460+ start_time = int (time.time() - 7 * 24 * 3600 ) * 1000 ,
461+ end_time = int (time.time()) * 1000 ,
462+ page_id = 1 ,
463+ paging_size = 50 ,
464+ recv_window = None
404465)
405466
406467records = client.sub_account().get_sub_account_internal_transfer_records()
0 commit comments