Module deriv_api.deriv_api
Classes
class DerivAPI (**options)-
The minimum functionality provided by DerivAPI, provides direct calls to the API.
api.cacheis available if you want to use the cached dataExamples
- Pass the arguments needed to create a connection:
>>> api = DerivAPI(endpoint='ws://...', app_id=1234)- create and use a previously opened connection:
>>> connection = await websockets.connect('ws://...') >>> api = DerivAPI(connection=connection)Parameters
options : dict with following keys connection : websockets.WebSocketClientProtocol A ready to use connection endpoint : String API server to connect to app_id : String Application ID of the API user lang : String Language of the API communication brand : String Brand name middleware : MiddleWares middlewares to call on certain API actions. Now two middlewares are supported: sendWillBeCalled and sendIsCalledProperties
cache: Cache Temporary cache default to InMemory storage : Cache If specified, uses a more persistent cache (local storage, etc.) events: Observable An Observable object that will send data when events like 'connect', 'send', 'message' happen
Ancestors
Methods
async def subscribe(self, request)-
Subscribe to a given request
Parameters
request : dict Subscribe requestExample
>>> proposal_subscription = api.subscribe({"proposal_open_contract": 1, "contract_id": 11111111, "subscribe": 1})Returns
Observable async def forget(self, subs_id)-
Forget / unsubscribe the specific subscription.
Parameters
subs_id : str subscription idReturns
Returns dict async def forget_all(self, *types)-
Forget / unsubscribe the subscriptions of given types.
Possible values are: 'ticks', 'candles', 'proposal', 'proposal_open_contract', 'balance', 'transaction'
Parameter
*types : Any number of non-keyword argumentsExample
api.forget_all("ticks", "candles")Returns
Returns the dict def expect_response(self, *msg_types)-
Expect specific message types
Parameters
*msg_types : variable number of non-key string argument Expect these types to be received by the APIReturns
Resolves to a single response or an array async def clear(self)-
Disconnect and cancel all the tasks
Inherited members
DerivAPICalls:active_symbolsapi_tokenapp_deleteapp_getapp_listapp_markup_detailsapp_markup_statisticsapp_registerapp_updateasset_indexauthorizebalancebuybuy_contract_for_multiple_accountscancelcashiercontract_updatecontract_update_historycontracts_forcopy_startcopy_stopcopytrading_listcopytrading_statisticscrypto_configdocument_uploadeconomic_calendarexchange_ratesget_account_statusget_financial_assessmentget_limitsget_self_exclusionget_settingsidentity_verification_document_addkyc_auth_statuslanding_companylanding_company_detailslogin_historylogoutmt5_depositmt5_get_settingsmt5_login_listmt5_new_accountmt5_password_changemt5_password_checkmt5_password_resetmt5_withdrawalnew_account_maltainvestnew_account_realnew_account_virtualoauth_appsp2p_advert_createp2p_advert_infop2p_advert_listp2p_advert_updatep2p_advertiser_advertsp2p_advertiser_createp2p_advertiser_infop2p_advertiser_listp2p_advertiser_payment_methodsp2p_advertiser_relationsp2p_advertiser_updatep2p_chat_createp2p_order_cancelp2p_order_confirmp2p_order_createp2p_order_disputep2p_order_infop2p_order_listp2p_order_reviewp2p_payment_methodsp2p_pingpayment_methodspaymentagent_createpaymentagent_detailspaymentagent_listpaymentagent_transferpaymentagent_withdrawpaymentagent_withdraw_justificationpayout_currenciespingportfolioprofit_tableproposalproposal_open_contractreality_checkresidence_listrevoke_oauth_appsellsell_contract_for_multiple_accountssell_expiredset_account_currencyset_financial_assessmentset_self_exclusionset_settingsstatementstates_listticksticks_historytimetnc_approvaltopup_virtualtrading_durationstrading_platform_investor_password_resettrading_platform_password_resettrading_serverstrading_timestransactiontransfer_between_accountsunsubscribe_emailverify_emailverify_email_cellxpertwebsite_status