Giter Site home page Giter Site logo

vsaveris / trading-technical-indicators Goto Github PK

View Code? Open in Web Editor NEW
110.0 7.0 32.0 38.43 MB

Trading Technical Indicators python library

Home Page: https://www.trading-technical-indicators.org/

License: MIT License

Python 100.00%
trading technical-indicators python-library machine-learning finance investing artificial-intelligence

trading-technical-indicators's People

Contributors

vsaveris 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar

trading-technical-indicators's Issues

Optimize indicators with long calculation times.

Tasks:

  • Optimize code for the indicators with long calculation times (those in bold in the list below).
  • Execute regression testing after each change.

The task is targeting planned release: 0.2 stable-release (01-01-2021)

Technical Indicators calculation times, for 3169 trading days.

  • Indicator = AccumulationDistributionLine Calculation time = 0.1 seconds.
  • Indicator = AverageTrueRange Calculation time = 0.02 seconds.
  • Indicator = BollingerBands Calculation time = 0.01 seconds.
  • Indicator = ChaikinMoneyFlow Calculation time = 0.01 seconds.
  • Indicator = ChaikinOscillator Calculation time = 0.1 seconds.
  • Indicator = ChandeMomentumOscillator Calculation time = 0.01 seconds.
  • Indicator = CommodityChannelIndex Calculation time = 0.94 seconds.
  • Indicator = DetrendedPriceOscillator Calculation time = 0.01 seconds.
  • Indicator = DirectionalMovementIndex Calculation time = 4.58 seconds.
  • Indicator = DoubleExponentialMovingAverage Calculation time = 0.01 seconds.
  • Indicator = EaseOfMovement Calculation time = 0.01 seconds.
  • Indicator = Envelopes Calculation time = 0.01 seconds.
  • Indicator = FibonacciRetracement Calculation time = 0.01 seconds.
  • Indicator = ForecastOscillator Calculation time = 2.37 seconds.
  • Indicator = IchimokuCloud Calculation time = 0.02 seconds.
  • Indicator = IntradayMovementIndex Calculation time = 0.01 seconds.
  • Indicator = KlingerOscillator Calculation time = 0.06 seconds.
  • Indicator = LinearRegressionIndicator Calculation time = 2.3 seconds.
  • Indicator = LinearRegressionSlope Calculation time = 0.01 seconds.
  • Indicator = MarketFacilitationIndex Calculation time = 0.01 seconds.
  • Indicator = MassIndex Calculation time = 0.01 seconds.
  • Indicator = MedianPrice Calculation time = 0.01 seconds.
  • Indicator = Momentum Calculation time = 0.01 seconds.
  • Indicator = MovingAverage (simple) Calculation time = 0.01 seconds.
  • Indicator = MovingAverage (exponential) Calculation time = 0.01 seconds.
  • Indicator = MovingAverage (time_series) Calculation time = 2.31 seconds.
  • Indicator = MovingAverage (triangular) Calculation time = 0.01 seconds.
  • Indicator = MovingAverage (variable) Calculation time = 0.35 seconds.
  • Indicator = MovingAverageConvergenceDivergence Calculation time = 0.01 seconds.
  • Indicator = NegativeVolumeIndex Calculation time = 0.21 seconds.
  • Indicator = OnBalanceVolume Calculation time = 0.01 seconds.
  • Indicator = ParabolicSAR Calculation time = 2.72 seconds.
  • Indicator = Performance Calculation time = 0.01 seconds.
  • Indicator = PositiveVolumeIndex Calculation time = 0.2 seconds.
  • Indicator = PriceAndVolumeTrend Calculation time = 0.22 seconds.
  • Indicator = PriceChannel Calculation time = 0.01 seconds.
  • Indicator = PriceOscillator Calculation time = 0.01 seconds.
  • Indicator = PriceRateOfChange Calculation time = 0.01 seconds.
  • Indicator = ProjectionBands Calculation time = 2.97 seconds.
  • Indicator = ProjectionOscillator Calculation time = 2.95 seconds.
  • Indicator = Qstick Calculation time = 0.01 seconds.
  • Indicator = RangeIndicator Calculation time = 0.18 seconds.
  • Indicator = RelativeMomentumIndex Calculation time = 0.3 seconds.
  • Indicator = RelativeStrengthIndex Calculation time = 1.06 seconds.
  • Indicator = RelativeVolatilityIndex Calculation time = 0.58 seconds.
  • Indicator = StandardDeviation Calculation time = 0.01 seconds.
  • Indicator = StochasticMomentumIndex Calculation time = 0.02 seconds.
  • Indicator = StochasticOscillator (fast) Calculation time = 0.01 seconds.
  • Indicator = StochasticOscillator (slow) Calculation time = 0.01 seconds.
  • Indicator = SwingIndex Calculation time = 0.02 seconds.
  • Indicator = TimeSeriesForecast Calculation time = 2.32 seconds.
  • Indicator = TripleExponentialMovingAverage Calculation time = 0.01 seconds.
  • Indicator = TypicalPrice Calculation time = 0.0 seconds.
  • Indicator = UltimateOscillator Calculation time = 0.02 seconds.
  • Indicator = VerticalHorizontalFilter Calculation time = 0.01 seconds.
  • Indicator = VolatilityChaikins Calculation time = 0.01 seconds.
  • Indicator = VolumeOscillator Calculation time = 0.01 seconds.
  • Indicator = VolumeRateOfChange Calculation time = 0.01 seconds.
  • Indicator = WeightedClose Calculation time = 0.01 seconds.
  • Indicator = WildersSmoothing Calculation time = 0.15 seconds.
  • Indicator = WilliamsAccumulationDistribution Calculation time = 0.02 seconds.
  • Indicator = WilliamsR Calculation time = 0.01 seconds.

Prepare release 0.1.b3

Tasks:

  • Execute runAllExamples
  • Execute runAllSimulation
  • Execute regression testing
  • Update package README file
  • Update version of the package in init and setup files
  • Create documentation locally and review it
  • Merge development branch to master and add release tag
  • Upload new package in to the pyPi
  • Update project site

Rework runSimulation method of the tti.indicators package, to consider portfolio when reacting in trading signals

runSimulation method applies currently trading signals as they received without considering the current portfolio status (long and short positions). As a result the simulation outcome is not reliable.

The method should be updated so that the trading signals will be applied considering long and short open positions.

Target release 0.1.b3

Tasks:

  • Rework runSimulation method
  • Test cases development and execution

Prepare stable release 0.2.0

Tasks:

  • Execute runAllExamples
  • Execute runAllSimulation
  • Execute regression testing
  • Update package README file
  • Update version of the package in init and setup files
  • Create documentation locally and review it
  • Merge development branch to master and add release tag
  • Upload new package in to the pyPi
  • Update project site

Machine Learning features implementation.

Machine learning features implementation progress tracker.

  • ML Features Development
  • ML Features Unit Tests Development
  • ML Features Unit Tests Execution
  • ML Features Documentation

runSimulation method is replaced by the new getTiSimulation method

The runSimulation method of thetti.indicators package will become deprecated in the next beta release. it will be replaced by the new method getTiSimulation. Details about the new method will be added here.

Development Tasks:

  • Implement deprecated exception for the runSimulation method (will be removed in the first stable release)
  • Implement the new getTiSimulation method in the tti.indicators package
  • Rework the not-released class TradingSimulation of the tti.utils package

Testing Tasks:

  • Add test for the deprecated method in the test_indicators_common.py and remove the existing tests for this method
  • Rework the test_utils_trading_simulation.py for matching the new implementation
  • Execute unit testing for the TradingSimulation class
  • Add tests for the getTiSimulation method in the test_indicators_common.py
  • Execute regression testing for the tti package

Remove deprecated function runSimulation

runSimulation function (_technical_indicator module of tti.indicators package) has been replaced by the getTiSimulation function in release 0.1.b3. It should be removed prior to release 1.0.0

Tasks:

  • Remove runSimulation function from module
  • Remove the TtiPackageDeprecatedMethod exception from the tti.utils package, exceptions module
  • Remove unit test case for the runSimulation function
  • Execute regression testing

Update getTiSimulation to return also a matplotlip.pyplot object with the simulation results

Currently the getTiSimulation returns a pandas.DataFrame with simulation data and a dict containing simulation statistics.

The function will be updated so to return also a matplotlib.pyplot object including the close price, exposure and balance during the simulation period. An example of such object is shown below:

simulation_AccumulationDistributionLine

Tasks:

  • Update code with the new feature
  • Update Unit Tests with the new feature
  • Update documentation code with the new feature (examples)

Include max_investment argument in the runSimulation method of tti.indicators package

Currently, in the runSimulation method of the tti.package, all the buy trading signals are processed, without any limitation on the investment.

This can bring some unrealistic scenarios, in case of a high number of consecutive buy signals. In that case the investment can become very high.

For this reason a new input argument should be introduced (max_investment). In case where max_investment already reached, new buy signals are being ignored, till some balance becomes available with a sell trading signal.

Simulation code, and returned simulation data should be updated accordingly. ignored_buy_signals entry should be included in the returned statistics.

Target release 0.1.b3

Tasks:

  • Update runSimulation method in the _technical_indicator.py module (tti.indicators package), as described above
  • Include additional tests for the runSimulation method in the test_indicators_common.py

Evaluate the implementation of additional technical indicators

Review and optionally implement the below Trading Technical Indicators.

  • Accumulation Swing Index
  • Aroon
  • Commodity Selection Index
  • Dynamic Momentum Index
  • Inertia
  • Linear Regression Trendline
  • Money Flow Index
  • Moving Average Volume Adjusted
  • Moving Average Weighted
  • R-Squared
  • Raff Regression Channel
  • Standard Deviation Channel
  • Standard Error
  • Standard Error Bands
  • Standard Error Channel

Each implementation has to be in a separate issue. This issue will be used for overall tracking.

57 vs 62 indicators

Hi,
the website states there are 62 indicators but with this code

from tti.indicators.properties.indicators_properties import INDICATORS_PROPERTIES

print(len(list(INDICATORS_PROPERTIES.keys())))

I get 57 indicators.

What's wrong?
PS: I'm Carlo, not Carlos ๐Ÿ˜ƒ
Thanks.

Renamed: Compatibility issues with the new pandas 1.2.0 release

Hi,
I wrote a simple script to test 0.2.
It retrieves all the indicators and tests each of them against your sample csv.

the code is

import pandas as pd
from tti.indicators import *
from tti.indicators.properties.indicators_properties import INDICATORS_PROPERTIES

indicators_list = list(INDICATORS_PROPERTIES.keys())

df = pd.read_csv('./sample_data.csv', parse_dates=True, index_col=0)

indicators = []

for i in range(len(indicators_list)):
    input_data_str = 'input_data={}'.format('df')
    indicators.append(eval('{}({})'.format(indicators_list[i], input_data_str)))
    print('{} โ†’ {}'.format(indicators_list[i], indicators[i].getTiSignal()[0]))

then its output is

AccumulationDistributionLine โ†’ buy
AverageTrueRange โ†’ buy
BollingerBands โ†’ hold
ChaikinMoneyFlow โ†’ hold
ChaikinOscillator โ†’ hold
ChandeMomentumOscillator โ†’ hold
CommodityChannelIndex โ†’ hold
DetrendedPriceOscillator โ†’ hold
DirectionalMovementIndex โ†’ hold
DoubleExponentialMovingAverage โ†’ buy
EaseOfMovement โ†’ hold
Envelopes โ†’ hold
FibonacciRetracement โ†’ hold

but then it excepts on the next one (ForecastOscillator) with
ValueError: cannot set using a slice indexer with a different length than the value.

What could have happened?
Thanks.

Review trading signals code, for all indicators.

Tasks:

  • Review trading signals code against Trading Analysis theory and modify whenever necessary.
  • Run trading simulation for validation.
  • Execute regression testing after each modification.

The task is targeting planned release: 0.2 stable-release (01-01-2021)

Task Status:

  • Accumulation Distribution Line
  • Average True Range
  • Bollinger Bands
  • Chaikin Money Flow
  • Chaikin Oscillator
  • Chande Momentum Oscillator
  • Commodity Channel Index
  • Detrended Price Oscillator
  • Directional Movement Index
  • Double Exponential Moving Average
  • Ease Of Movement
  • Envelopes
  • Fibonacci Retracement
  • Forecast Oscillator
  • Ichimoku Cloud
  • Intraday Movement Index
  • Klinger Oscillator
  • Linear Regression Indicator
  • Linear Regression Slope
  • Market Facilitation Index
  • Mass Index
  • Median Price
  • Momentum
  • Exponential Moving Average
  • Simple Moving Average
  • Time-Series Moving Average
  • Triangular Moving Average
  • Variable Moving Average
  • Moving Average Convergence Divergence
  • Negative Volume Index
  • On Balance Volume
  • Parabolic SAR
  • Performance
  • Positive Volume Index
  • Price And Volume Trend
  • Price Channel
  • Price Oscillator
  • Price Rate Of Change
  • Projection Bands
  • Projection Oscillator
  • Qstick
  • Range Indicator
  • Relative Momentum Index
  • Relative Strength Index
  • Relative Volatility Index
  • Standard Deviation
  • Stochastic Momentum Index
  • Fast Stochastic Oscillator
  • Slow Stochastic Oscillator
  • Swing Index
  • Time Series Forecast
  • Triple Exponential Moving Average
  • Typical Price
  • Ultimate Oscillator
  • Vertical Horizontal Filter
  • Volatility Chaikins
  • Volume Oscillator
  • Volume Rate Of Change
  • Weighted Close
  • Wilders Smoothing
  • Williams Accumulation Distribution
  • Williams %R

Remove commission argument from the runSimulation method of the tti.indicators package

runSimulation method currently has an input argument called commission:
commission (float, default=0.0): Commission for each transaction.

The runSimulation method is used for evaluating trading signals initiated by the indicators, for a specific stock data.

commission argument is not needed for the specific purpose since can provide misleading results about the indicator, so it will be removed. The only arguments will remain in the method are:

    close_values (pandas.DataFrame): The close prices of the stock, for
        the whole simulation period. Index is of type DateTimeIndex
        with same values as the input to the indicator data. It
        contains one column close.

    max_items_per_transaction (int, default=1): The maximum number of
        stocks to be traded on each open_long or open_short
        transaction.

    max_investment(float, default=None): Maximum investment for all the
        opened positions (short and long). If the sum of all
        the opened positions reached the maximum investment, then it is
        not allowed to open a new position. A new position can be
        opened when some balance becomes available from a position
        close. If set to  None, then there is no upper limit for the opened
        positions.

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.