get_instrumets for cryptofeed.FeedHandler
							parent
							
								
									61c9d7fa38
								
							
						
					
					
						commit
						7d18fe6a54
					
				|  | @ -361,6 +361,35 @@ class Client: | ||||||
| 
 | 
 | ||||||
|         return flat |         return flat | ||||||
| 
 | 
 | ||||||
|  |     async def get_instruments( | ||||||
|  |         self, | ||||||
|  |         currency: str = 'btc', | ||||||
|  |         kind: str = 'option', | ||||||
|  |         expired: bool = False, | ||||||
|  | 
 | ||||||
|  |     ) -> list[Symbol]: | ||||||
|  |         """ | ||||||
|  |         Get instruments for cryptoFeed.FeedHandler. | ||||||
|  |         """ | ||||||
|  |         params: dict[str, str] = { | ||||||
|  |             'currency': currency.upper(), | ||||||
|  |             'kind': kind, | ||||||
|  |             'expired': expired, | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         r: JSONRPCResult = await self._json_rpc_auth_wrapper( | ||||||
|  |             'public/get_instruments', | ||||||
|  |             params, | ||||||
|  |         ) | ||||||
|  |         resp = r.result  | ||||||
|  |         response_list = [] | ||||||
|  | 
 | ||||||
|  |         for i in range(len(resp) // 10): | ||||||
|  |             element = resp[i] | ||||||
|  |             response_list.append(piker_sym_to_cb_sym(element['instrument_name'])) | ||||||
|  | 
 | ||||||
|  |         return response_list | ||||||
|  | 
 | ||||||
|     async def submit_limit( |     async def submit_limit( | ||||||
|         self, |         self, | ||||||
|         symbol: str, |         symbol: str, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue