Git Product home page Git Product logo

finlab_crypto's People

Contributors

benbilly3 avatar finlab-python avatar jrycw avatar koreal6803 avatar minggnim avatar yaotechuang 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

finlab_crypto's Issues

Mutable default arguments

class Strategy(object):

    def backtest(self, ohlcv, variables=dict(),
                         filters=dict(), lookback=None, plot=False,
                         signals=False, side='long', cscv_nbins=10,
                         cscv_objective=lambda r: r.mean(), html=None, compounded=True, execution_price='close', **args):

There might be a potential issue if using dictionary as the default argument for variables and filters, since dictionary is mutable.

I will argue that using None as the default argument might be a safer approach.

TypeError: add_yaxis() in utility.py:171

167 figures['entries & exits'] = pd.DataFrame(
168     {'entries':entries.squeeze(), 'exits': exits.squeeze()})
169 figures['performance'] = portfolio.cumulative_returns()

--> 171 c, info = chart.chart(ohlcv, overlaps=overlaps,
172 figures=figures, markerlines=mark_lines,
173 start_date=ohlcv.index[-min(1000, len(ohlcv))], end_date=ohlcv.index[-1], k_colors=k_colors)
174 c.load_javascript()
175 if html is not None:
...
161 # indicators
162 #################
164 def is_item(item):

TypeError: add_yaxis() got an unexpected keyword argument 'yaxis_data'

seems due to pyecharts library, you need to update your utility.py file to the new pyecharts version that receive 'y_axis' instead of 'yaxis_data'

Cannot Install as conflicting dependencies

ERROR: Cannot install finlab-crypto==0.1.0, finlab-crypto==0.1.1, finlab-crypto==0.1.10, finlab-crypto==0.1.11, finlab-crypto==0.1.12, finlab-crypto==0.1.13, finlab-crypto==0.1.14, finlab-crypto==0.1.15, finlab-crypto==0.1.16, finlab-crypto==0.1.17, finlab-crypto==0.1.18, finlab-crypto==0.1.19, finlab-crypto==0.1.2, finlab-crypto==0.1.3, finlab-crypto==0.1.4, finlab-crypto==0.1.5, finlab-crypto==0.1.6, finlab-crypto==0.1.7, finlab-crypto==0.1.8, finlab-crypto==0.1.9, finlab-crypto==0.2.0, finlab-crypto==0.2.1, finlab-crypto==0.2.10, finlab-crypto==0.2.11, finlab-crypto==0.2.12, finlab-crypto==0.2.13, finlab-crypto==0.2.14, finlab-crypto==0.2.15, finlab-crypto==0.2.16, finlab-crypto==0.2.17, finlab-crypto==0.2.18, finlab-crypto==0.2.19, finlab-crypto==0.2.2, finlab-crypto==0.2.20, finlab-crypto==0.2.21, finlab-crypto==0.2.22, finlab-crypto==0.2.23, finlab-crypto==0.2.3, finlab-crypto==0.2.4, finlab-crypto==0.2.5, finlab-crypto==0.2.6, finlab-crypto==0.2.7, finlab-crypto==0.2.8 and finlab-crypto==0.2.9 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

stop loss example

could you please provide an example how to use stop loss and trailing stop with backtest

Unable to draw candlestick chart

Hello,

I am currently using Python 3.8.4 to run the tutorial with the finlab_crypto version 0.2.27.
I have encountered an issue where candlestick charts are not being displayed during the test.
image
Additionally, when running the optimization process, I encountered a TypeError: "pivot() takes 1 positional argument but 3 were given."
image
As a newcomer to Python, I would appreciate guidance on whether I need to install any additional dependencies or provide additional information to help identify the cause of these issues.

Thank you for your assistance.

There are some similar code in Strategy and Filter

__init__, __call__ , set_parameters and show_parameters methods looks similar in Strategy and Filter.
My suggestion is using Inheritance to refractor the code as following:

class BaseDec:

    delattr_clsname = {'Strategy'}

    def __init__(self, **default_parameters):
        self.func = None
        self._variables = None
        self.filters = {}
        self._default_parameters = default_parameters
        self.set_parameters(default_parameters)

    def __call__(self, func):
        self.func = func
        return self

    def set_parameters(self, variables):
        if type(self).__name__ in self.delattr_clsname:
          stop_vars = ['sl_stop', 'tp_stop', 'ts_stop']
          for svar in stop_vars:
              if hasattr(self, svar):
                  delattr(self, svar)

        if variables:
            for key, val in variables.items():
                setattr(self, key, val)

        self._variables = variables

    def show_parameters(self):
        print(self._variables)

class Filter(BaseDec):
    ...

class Strategy(BaseDec):
    ...

Include a .gitignore file

I would like to suggest including a .gitignore file in the repo.
We could use the template that github provided and modify it in the future if needed.

Stocks support

Stumbled upon this while researching vectorbt. I have few questions. hope you can answer

  1. can this be used for stocks
  2. How easy or difficult it is to integrate with alpaca for live trading

can u please give some guidance for me to code alpaca brokerage for stocks

vectorbt upgrade

Thanks for sharing this great repo!

I can't help but notice that the version of vectorbt is a bit outdated. I think it'd be very helpful to upgrade it to the latest 0.21.0, which offers enhanced stats and pnl analysis, and many more new features. I've created a pr #16 to support this. Hopefully you also find it useful. Thanks!

Args in def get_nbars_binance(...)

in function defined in crawler.py file row 100
get_nbars_binance(symbol, interval, nbars, client):
...
client (Binance.Client) (optional): Binance Client object.

It is not optional.
I've fixed with this: get_nbars_binance(symbol, interval, nbars, client=Client()):

objective function set up as lambda r: r.mean()

In DH Bailey's paper "The probability of backtest overfitting", they used sharpe ratio as their default objective function.
However, in fin_crypto library, objective function was set up as objective=lambda r: r.mean().
Just want to clarify, needn't the default of objective function be set as objective=lambda r: sharpe_ratio(r)?

[Feature request] Support for cctx

Great project!. A feature suggestion/request: cctx already standardizes data from many exchanges. Would be great to be able to use that data in order to have access to instruments supported on different exchanges (ex: futures, deribit options).

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.