mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
- [Binance Ema](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pandas_ta as ta
|
||||
import pandas as pd
|
||||
|
||||
|
||||
import ccxt # noqa: E402
|
||||
|
||||
|
||||
print('CCXT Version:', ccxt.__version__)
|
||||
|
||||
|
||||
def main():
|
||||
exchange = ccxt.binance()
|
||||
markets = exchange.load_markets()
|
||||
# exchange.verbose = True # uncomment for debugging purposes
|
||||
ohlcv = exchange.fetch_ohlcv('BTC/USDT', '1m')
|
||||
if len(ohlcv):
|
||||
df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
|
||||
df['datetime'] = pd.to_datetime(df['timestamp'], unit='ms')
|
||||
ema = df.ta.ema()
|
||||
df = pd.concat([df, ema], axis=1)
|
||||
print(df)
|
||||
|
||||
|
||||
main()
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user