Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitgetLimited
GitHub Repository: BitgetLimited/V3-bitget-api-sdk
Path: blob/master/bitget-python-sdk-api/bitget/__pycache__/spot_api.cpython-38.pyc
732 views
U

��_��@s0ddlmZddlTddlZGdd�de�ZdS)�)�Client)�*�Nc@s�eZdZd1dd�Zdd�Zdd�Zd2d	d
�Zd3dd
�Zdd�Zd4dd�Z	dd�Z
d5dd�Zd6dd�Zd7dd�Z
d8dd�Zd9dd�Zdd�Zd d!�Zd:d"d#�Zd$d%�Zd;d&d'�Zd(d)�Zd*d+�Zd<d,d-�Zd=d.d/�Zd0S)>�SpotAPIFcCst�||||||�dS�N)r�__init__)�self�api_key�api_secret_key�
passphrase�use_server_time�first�r�Q/Users/larry/PycharmProjects/V3-Open-API-SDK/okex-python-sdk-api/okex/spot_api.pyrszSpotAPI.__init__cCs|�tt�Sr)�_request_without_params�GET�SPOT_ACCOUNT_INFO�rrrr�get_account_infoszSpotAPI.get_account_infocCs|�ttt|��Sr)rr�SPOT_COIN_ACCOUNT_INFO�str)r�currencyrrr�get_coin_account_infoszSpotAPI.get_coin_account_info�cCsRi}|r||d<|r||d<|r(||d<|r4||d<|jttt|�d|dd�S)N�after�before�limit�typez/ledgerT��cursor)�_request_with_paramsr�SPOT_LEDGER_RECORDr)rrrrrr�paramsrrr�get_ledger_recordszSpotAPI.get_ledger_record�0c	
	Cs$||||||||d�}	|�tt|	�S)N)�
instrument_id�side�
client_oidr�size�price�
order_type�notional)r �POST�
SPOT_ORDER)
rr%r&r'rr(r)r*r+r"rrr�
take_order szSpotAPI.take_ordercCs|�tt|�Sr)r r,�SPOT_ORDERS�rr"rrr�take_orders$szSpotAPI.take_orderscCs@d|i}|r"|�ttt|�|�S|r<|�ttt|�|�SdS�Nr%)r r,�SPOT_REVOKE_ORDERr�rr%�order_idr'r"rrr�revoke_order(s
zSpotAPI.revoke_ordercCs|�tt|�Sr)r r,�SPOT_REVOKE_ORDERSr0rrr�
revoke_orders/szSpotAPI.revoke_orderscCs@||d�}|r||d<|r"||d<|r.||d<|jtt|dd�S)N)r%�staterrrTr)r r�SPOT_ORDERS_LIST)rr%r9rrrr"rrr�get_orders_list3s
zSpotAPI.get_orders_listcCs@d|i}|r"|�ttt|�|�S|r<|�ttt|�|�SdSr2)r r�SPOT_ORDER_INFOrr4rrr�get_order_info>s
zSpotAPI.get_order_infocCs>d|i}|r||d<|r ||d<|r,||d<|jtt|dd�S)Nr%rrrTr)r r�SPOT_ORDERS_PENDING)rr%rrrr"rrr�get_orders_pendingEszSpotAPI.get_orders_pendingcCsJd|i}|r||d<|r ||d<|r,||d<|r8||d<|jtt|dd�S)Nr%r5rrrTr)r r�
SPOT_FILLS)rr%r5rrrr"rrr�	get_fillsOszSpotAPI.get_fillscCs�|||||d�}|dkr6||d<||d<|r�||d<nl|dkrP|	|d<||d<nR|dkrr|
|d	<||d
<||d<n0|dkr�|
|d
<||d<||d<||d<||d<|�tt|�S)N)r%�moder*r(r&�1�
trigger_price�
algo_price�	algo_type�2�
callback_rate�3�
algo_variance�
avg_amount�limit_price�4�sweep_range�sweep_ratio�single_limit�
time_interval)r r,�SPOT_ORDER_ALGO)rr%rBr*r(r&rDrErFrHrJrKrLrNrOrPrQr"rrr�take_order_algo\s(


zSpotAPI.take_order_algocCs|||d�}|�tt|�S)N)r%�algo_idsr*)r r,�SPOT_CANCEL_ALGOS)rr%rTr*r"rrr�cancel_algosuszSpotAPI.cancel_algoscCs|�tt�Sr)rr�SPOT_TRADE_FEErrrr�
get_trade_feeyszSpotAPI.get_trade_feec	CsV||d�}|r||d<n|r$||d<|r0||d<|r<||d<|rH||d<|�tt|�S)N)r%r*�status�algo_idrrr)r r�SPOT_GET_ORDER_ALGOS)	rr%r*rYrZrrrr"rrr�get_order_algos}s

zSpotAPI.get_order_algoscCs|�tt�Sr)rr�SPOT_COIN_INFOrrrr�
get_coin_info�szSpotAPI.get_coin_infocCs6i}|r||d<|r||d<|�ttt|�d|�S)Nr(�depthz/book)r r�
SPOT_DEPTHr)rr%r(r_r"rrr�	get_depth�szSpotAPI.get_depthcCs|�tt�Sr)rr�SPOT_TICKERrrrr�
get_ticker�szSpotAPI.get_tickercCs|�ttt|�d�S)Nz/ticker)rr�SPOT_SPECIFIC_TICKERr)rr%rrr�get_specific_ticker�szSpotAPI.get_specific_tickercCs*i}|r||d<|�ttt|�d|�S)Nrz/trades)r r�	SPOT_DEALr)rr%rr"rrr�get_deal�szSpotAPI.get_dealcCsBi}|r||d<|r||d<|r(||d<|�ttt|�d|�S)N�start�end�granularityz/candles)r r�
SPOT_KLINEr)rr%rjrhrir"rrr�	get_kline�szSpotAPI.get_klineN)FF)rrrr)rrrrr$r)rr)rrr)rr)rrr)rrrr)rrrrrrrrrrr)rrrrr)rr)r)rrr)�__name__�
__module__�__qualname__rrrr#r.r1r6r8r;r=r?rArSrVrXr\r^rarcrergrlrrrrrs>









�


	
r)�clientr�consts�jsonrrrrr�<module>s