Giter VIP home page Giter VIP logo

live_trading_indicators's People

Contributors

hal9000cc avatar lapphan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

live_trading_indicators's Issues

Indicator value can not be calculated because of the the error " Bad date or time value: Time end cannot be set in live mode"

Hi i have run the following code:
import live_trading_indicators as lti
import datetime as dt
import talib as ta
import pandas as pd

print(f'Now is {utcnow} UTC')
indicators = lti.Indicators('binance',20230701,with_incomplete_bar=True)
print(indicators.time_end)
ohlcv = indicators.OHLCV('btcusdt', '1h')
sma = indicators.SMA('btcusdt', '1h',period = 10)
print(indicators.time_end)

It give me an error, when executing the code to calculate SMA, could you please take a look at it?
Traceback (most recent call last):
File "ltiimcompletebar.py", line 13, in
sma = indicators.SMA('btcusdt', '1h',period = 10)
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 445, in call
return self.indicators.get_indicator_out(self.indicator_name, self.indicator_module, symbols, use_timeframe,
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 298, in get_indicator_out
out = self.get_indicator_out_cached(indicator_name, indicator_module, symbols, timeframe, indicator_kwargs,
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 278, in get_indicator_out_cached
out_valid = indicator_module.get_indicator_out(self, symbols, timeframe, out_for_grow, **indicator_kwargs)
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/SMA.py", line 9, in get_indicator_out
ohlcv = indicators.OHLCV.full_data(symbol, timeframe)
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 432, in full_data
return self.indicators.get_indicator_out(self.indicator_name, self.indicator_module, symbols, timeframe,
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 290, in get_indicator_out
use_time_begin, use_time_end = self.check_call_time_intervals(time_begin, time_end, timeframe)
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 223, in check_call_time_intervals
return self.check_call_time_intervals_live(time_begin, time_end, timeframe)
File "/usr/local/lib/python3.8/dist-packages/live_trading_indicators/indicators_set/init.py", line 205, in check_call_time_intervals_live
raise LTIExceptionBadTimeParameter('Time end cannot be set in live mode')
live_trading_indicators.exceptions.LTIExceptionBadTimeParameter: Bad date or time value: Time end cannot be set in live mode

Zig-zag missing pivots

Compare to Zig Zag indicator on TradingView, live_trading_indicators's ZigZag is missing 4 pivots:

  • 2 very first pivots (6427.0 and 10540.0)
  • 2 last pivots: the last completed pivot and the incomplete pivot (31059.0 and 27423.9)

What's showing on TradingView:

image

What I've done:

#lti.py
import live_trading_indicators as lti

indicators = lti.Indicators('ccxt.binanceusdm', '2019-09-08', '2023-05-08')
ohlcv = indicators.OHLCV('BTCUSDT', '1d')
print(ohlcv)
dataframe = ohlcv.pandas()
print(dataframe.head())
zigzag = indicators.ZigZag('BTCUSDT', '1d', delta=0.5, end_points=True)
print(zigzag)
dataframe = zigzag.pandas()
dataframe = dataframe[dataframe['pivot_types'].values != 0]
print(dataframe)
#console ouput
~/live_trading_indicators$ python3 lti.py
2023-05-09 20:12:08:root:725:102 INFO Download using xxct.binanceusdm symbol BTCUSDT timeframe 1d from 2019-09-08T00:00:00.000, bars: 1339
(OHLCV data) source: ccxt.binanceusdm, symbol: BTCUSDT, timeframe: 1d
date: 2019-09-08T00:00 - 2023-05-08T00:00 (length: 1339)
empty bars: count 0 (0.00 %), max consecutive 0
Values: time, open, high, low, close, volume
        time      open      high       low     close     volume
0 2019-09-08  10000.00  10412.65  10000.00  10391.63   3096.291
1 2019-09-09  10316.62  10475.54  10077.22  10307.00  14824.373
2 2019-09-10  10307.00  10382.97   9940.87  10102.02   9068.955
3 2019-09-11  10094.27  10293.11   9884.31  10159.55  10897.922
4 2019-09-12  10163.06  10450.13  10042.12  10415.13  15609.634
(IndicatorData) source: ccxt.binanceusdm, name: ZigZag, symbol: BTCUSDT, timeframe: 1d, allowed nan
date: 2019-09-08T00:00 - 2023-05-08T00:00 (length: 1339)
Values: time, pivots, pivot_types
           time    pivots  pivot_types
1    2019-09-09       NaN            1
187  2020-03-13   3621.81           -1
584  2021-04-14  64986.11            1
619  2021-05-19  28688.00           -1
794  2021-11-10  69198.70            1
1170 2022-11-21  15443.20           -1

Please help me to get all missing pivots.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.