-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday1_ccxt.py
More file actions
32 lines (25 loc) · 942 Bytes
/
Copy pathday1_ccxt.py
File metadata and controls
32 lines (25 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
DataDeFi CCXT exchange stub — vendored from micro/services/day1_ccxt.py.
Wires the public CCXT REST surface at {origin}/api/ccxt (markets, ticker, orderbook, ohlcv).
Configure origin via DATADEFI_API_BASE_URL or DAY1_BASE_URL (default https://exchange.datadefi.ai).
"""
import ccxt
import os
def _upstream_api_origin() -> str:
raw = (
os.getenv('DATADEFI_API_BASE_URL')
or os.getenv('DAY1_BASE_URL')
or 'https://exchange.datadefi.ai'
).strip()
host = raw.split('://', 1)[-1].split('/')[0].lower()
# Note: api.datadefi.ai is no longer treated as deprecated
return raw.rstrip('/')
class day1(ccxt.Exchange):
def describe(self):
return self.deep_extend(super().describe(), {
"id": "day1",
"name": "DataDeFi Genomic Market",
"urls": {"api": {"public": _upstream_api_origin() + "/api/ccxt"}},
})
_api_key = os.getenv("DATADEFI_API_KEY") or os.getenv("DAY1_API_KEY")
day1_exchange = day1({"apiKey": _api_key})