Initial TradeBot implementation
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from crypto_spot_bot.indicators import add_indicators
|
||||
from crypto_spot_bot.models import Candle
|
||||
|
||||
|
||||
def test_add_indicators_populates_long_periods() -> None:
|
||||
candles = [
|
||||
Candle(
|
||||
timestamp=index,
|
||||
open=100 + index * 0.1,
|
||||
high=101 + index * 0.1,
|
||||
low=99 + index * 0.1,
|
||||
close=100 + index * 0.1,
|
||||
volume=10 + index,
|
||||
)
|
||||
for index in range(240)
|
||||
]
|
||||
|
||||
add_indicators(candles)
|
||||
|
||||
latest = candles[-1]
|
||||
assert latest.ema_20 is not None
|
||||
assert latest.ema_50 is not None
|
||||
assert latest.ema_200 is not None
|
||||
assert latest.rsi_14 is not None
|
||||
assert latest.atr_14 is not None
|
||||
assert latest.volume_ma_20 is not None
|
||||
Reference in New Issue
Block a user