@@ -424,14 +424,15 @@ async def upsert_portfolio_history(self, portfolio_histories) -> list:
424
424
).execute ()).data
425
425
426
426
async def fetch_candles_history_range (
427
- self , exchange : str , symbol : str , time_frame : commons_enums .TimeFrames
427
+ self , exchange : str , symbol : str , time_frame : commons_enums .TimeFrames , use_production_db : bool
428
428
) -> (typing .Union [float , None ], typing .Union [float , None ]):
429
429
params = {
430
430
"exchange_internal_name" : exchange ,
431
431
"symbol" : symbol ,
432
432
"time_frame" : time_frame .value ,
433
433
}
434
- range_return = (await self .postgres_functions ().invoke (
434
+ db_functions = self .production_anon_postgres_functions () if use_production_db else self .postgres_functions ()
435
+ range_return = (await db_functions .invoke (
435
436
"get_ohlcv_range" ,
436
437
{"body" : params }
437
438
))["data" ]
@@ -511,6 +512,14 @@ async def get_production_anon_client(self):
511
512
)
512
513
return self .production_anon_client
513
514
515
+ def _get_production_anon_auth_headers (self ):
516
+ return self ._get_anon_auth_headers (constants .COMMUNITY_PRODUCTION_BACKEND_KEY )
517
+
518
+ def production_anon_postgres_functions (self ):
519
+ return self .postgres_functions (
520
+ url = constants .COMMUNITY_PRODUCTION_BACKEND_URL , auth_headers = self ._get_production_anon_auth_headers ()
521
+ )
522
+
514
523
async def _paginated_fetch_historical_data (
515
524
self , client , table_name : str , select : str , matcher : dict ,
516
525
first_open_time : float , last_open_time : float
0 commit comments