forked from kieran-mackle/autotrader-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindiview.py
28 lines (22 loc) · 799 Bytes
/
indiview.py
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
# """This is an example of using AutoTraders plotting module."""
from datetime import datetime
from autotrader import AutoTrader, AutoPlot, indicators
# Instantiate AutoTrader and configure the exchange to trade on/immitate
at = AutoTrader()
at.configure(broker="ccxt:bybit")
# Run AutoTrader to get the broker connection(s)
broker = at.run()
# Get candles
instrument = "ETH/USDT"
data = broker.get_candles(
instrument=instrument,
granularity="1d",
start_time=datetime(2023, 1, 1),
end_time=datetime(2024, 2, 1),
)
# Construct indicators dictionary
halftrend_df = indicators.halftrend(data)
indicator_dict = {"HalfTrend": {"type": "HalfTrend", "data": halftrend_df}}
# Instantiate AutoPlot and plot
ap = AutoPlot(data)
ap.plot(indicators=indicator_dict, instrument=instrument)