Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get current price in Strategy's next? #40

Open
mr-m0nst3r opened this issue Mar 11, 2021 · 0 comments
Open

How to get current price in Strategy's next? #40

mr-m0nst3r opened this issue Mar 11, 2021 · 0 comments

Comments

@mr-m0nst3r
Copy link

Hi there,

I need to get current market price in the next function to make decisions.

Tried to change ccxt/ccxtstore.py, add some code to get fetch_ticket information.

def __init__(self, exchange, currency, config, retries, debug=False, sandbox=False):
        self.exchange = getattr(ccxt, exchange)(config)
        # print("self.exchange",self.exchange)
        print("self.exchange.fetch_ticker", self.exchange.fetch_ticker('USDT/HUSD'))

Here's the output:

self.exchange.fetch_ticker {'symbol': 'USDT/HUSD', 'timestamp': 1615448013555, 'datetime': '2021-03-11T07:33:33.555Z', 'high': 1.0006, 'low': 0.9995, 'bid': 0.9997, 'bidVolume': 42300.4802, 'ask': 0.9998, 'askVolume': 136145.3142, 'vwap': 1.000125720339054, 'open': 1.0004, 'close': 0.9997, 'last': 0.9997, 'previousClose': None, 'change': -0.0006999999999999229, 'percentage': -0.06997201119551409, 'average': 1.0000499999999999, 'baseVolume': 105604769.11847508, 'quoteVolume': 105618045.78585435, 'info': {'amount': 105604769.11847508, 'open': 1.0004, 'close': 0.9997, 'high': 1.0006, 'id': 208846147104, 'count': 79494, 'low': 0.9995, 'version': 208846147104, 'ask': [0.9998, 136145.3142], 'vol': 105618045.78585435, 'bid': [0.9997, 42300.4802]}}
2021-03-11 15:33:42.040526 USDTHUSD Data Status: DELAYED, Order Status: 3
2021-03-11 15:33:44.140944 USDTHUSD Data Status: LIVE, Order Status: 4
2021-03-11, DIFF = HIGH - SMA30: 0.0

But I'm confused how should I call it in the Strategy's next function.

Any suggestions?

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant