39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
|
|
import os
|
||
|
|
os.environ["SMC_CREDIT"] = "0"
|
||
|
|
import asyncio, pandas as pd
|
||
|
|
from execution.paper_exchange import PaperExchangeClient
|
||
|
|
from core.data_feed import DataFeed
|
||
|
|
from indicators.ict_engine import ICTEngine
|
||
|
|
|
||
|
|
async def debug():
|
||
|
|
client = PaperExchangeClient(300)
|
||
|
|
await client.connect()
|
||
|
|
feed = DataFeed(client)
|
||
|
|
await feed.connect()
|
||
|
|
engine = ICTEngine()
|
||
|
|
print("Swing length:", engine.swing_length)
|
||
|
|
syms = ["FET/USDT", "BTC/USDT", "ETH/USDT", "ADA/USDT", "MATIC/USDT"]
|
||
|
|
tfs_list = ["1h", "15m"]
|
||
|
|
for sym in syms:
|
||
|
|
await feed.fetch_multi_timeframe(sym)
|
||
|
|
for tf in tfs_list:
|
||
|
|
df = feed.get_dataframe(sym, tf)
|
||
|
|
signals = engine.analyze(df)
|
||
|
|
ob = signals.active_order_blocks
|
||
|
|
fvg = signals.active_fvg
|
||
|
|
price = float(df["close"].iloc[-1])
|
||
|
|
print("%s %s price=%.4f OB=%d FVG=%d BOS=%s CHOCH=%s" % (sym, tf, price, len(ob), len(fvg), signals.latest_bos, signals.latest_choch))
|
||
|
|
if len(ob) > 0:
|
||
|
|
for _, r in ob.iterrows():
|
||
|
|
d, t, b = int(r["OB"]), float(r["Top"]), float(r["Bottom"])
|
||
|
|
tag = "IN_ZONE" if b <= price <= t else ""
|
||
|
|
print(" OB dir=%d [%.6f - %.6f] %s" % (d, b, t, tag))
|
||
|
|
if len(fvg) > 0:
|
||
|
|
for _, r in fvg.iterrows():
|
||
|
|
d, t, b = int(r["FVG"]), float(r["Top"]), float(r["Bottom"])
|
||
|
|
tag = "IN_ZONE" if b <= price <= t else ""
|
||
|
|
print(" FVG dir=%d [%.6f - %.6f] %s" % (d, b, t, tag))
|
||
|
|
await client.disconnect()
|
||
|
|
|
||
|
|
asyncio.run(debug())
|