mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
- [Rsi](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
import pandas_ta as ta
|
||||
import pandas as pd
|
||||
import ccxt
|
||||
print('CCXT Version:', ccxt.__version__)
|
||||
|
||||
exchange = ccxt.binance()
|
||||
symbol = 'BTC/USDT'
|
||||
timeframe = '1m'
|
||||
limit = 500
|
||||
rsi_length = 100
|
||||
while True:
|
||||
try:
|
||||
ohlcv = exchange.fetch_ohlcv(symbol, timeframe)
|
||||
print('--------------------------------------------------------------')
|
||||
if len(ohlcv):
|
||||
df = pd.DataFrame(ohlcv, columns=['time', 'open', 'high', 'low', 'close', 'volume'])
|
||||
df['time'] = pd.to_datetime(df['time'], unit='ms')
|
||||
df = pd.concat([df, df.ta.rsi(length=rsi_length)], axis=1)
|
||||
print(df[-20:])
|
||||
print(exchange.iso8601 (exchange.milliseconds()))
|
||||
except Exception as e:
|
||||
print(type(e).__name__, str(e))
|
||||
|
||||
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user