-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_script.py
More file actions
28 lines (24 loc) · 928 Bytes
/
Copy pathtest_script.py
File metadata and controls
28 lines (24 loc) · 928 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
import os, json, asyncio
from datetime import datetime, timedelta
import pytz
from tools.session_analyzer import analyze_forex_session
async def run():
# EURUSD London Open
os.environ.pop("CALENDAR_OVERRIDE_EVENTS", None)
print(await analyze_forex_session("EUR/USD", "london"))
# GBPUSD NY session with NFP day (override)
nfp_time = datetime.now(pytz.UTC) + timedelta(hours=1)
os.environ["CALENDAR_OVERRIDE_EVENTS"] = json.dumps([{
"event": "US Non-Farm Payrolls (NFP)",
"currency": "USD",
"country": "USD",
"datetime": nfp_time.isoformat(),
"impact": "high",
"event_type": "NFP",
"source": "override"
}])
print(await analyze_forex_session("GBP/USD", "ny"))
# USDJPY Asia session with no events
os.environ["CALENDAR_OVERRIDE_EVENTS"] = json.dumps([])
print(await analyze_forex_session("USD/JPY", "asian"))
asyncio.run(run())