-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotes-Websockets,etc.txt
95 lines (91 loc) · 3.76 KB
/
Notes-Websockets,etc.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
------------------------------Binance API-------------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--------------------------------
API requests:
klines - symbol, interval, limit are required <= use this with limit 60 to grab the 5min and 1hr data (12hrs) interval 1m
also use limit 168 to grab the 24hr and 1wk data with interval 1h
gives enough datapoints for RSI also
ticker/price - symbol is optional
ticker/24hr - symbol is required or else 40 weight <= use this to grab the 24hr data for the marketwindow at start maybe?
--------------------------------
Sample:
url = "https://api.binance.com/api/v3/klines?symbol=BNBBTC&interval=15m&limit=10"
response = requests.request("GET", url)
data = json.loads(response.text)
print(data)
--------------------------------
Data return format for klines (single-row array):
0 = Open Time
1 = Open
2 = High
3 = Low
4 = Close
5 = Volume
6 = Close Time
7,8 = Quote asset volume, number of trades
--------------------------------
Data return format for ticker/price (multi-row or single-row of dicts):
"symbol" key
"price" key
--------------------------------
Notes:
Best way to grab all symbols is https://api.binance.com/api/v3/ticker/price and get prices at same time
Need to check for a possible 429 response to initiate a cooldown on updating prices
Need to look into using websocket instead tbh, probably a lot better
Kline intervals are as follows:
1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
---------------------------------Bitfinex API:--------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
API requests:
tickers - symbols (can use ALL to grab all)
conf/pub:list:pair:exchange - None required (this grabs all symbols, all trades start with a t)
candles/trade:1m:tBTCUSD/hist - limit(default 100), sort (1 is old first, -1 is old last)
--------------------------------
Data return format for tickers (single-row or multi-row array):
0 = SYMBOL
1 = BID
2 = BID_SIZE
3 = ASK
4 = ASK_SIZE
5 = DAILY_CHANGE
6 = DAILY_CHANGE_RELATIVE
7 = LAST_PRICE
8 = VOLUME
9 = HIGH
10 = LOW
--------------------------------
Data return format for candles (single-row array)
0 = MTS
1 = OPEN
2 = CLOSE
3 = HIGH
4 = LOW
5 = VOLUME
--------------------------------
Candles path options:
Always in format of /trade:>insert timeframe<:>insert symbol</hist
Timeframe choose from: 1m,5m,15m,30m,1h,3h,6h,12h,1D,7D,14D,1M
--------------------------------
Timeframe differences vs binance:
Missing 3m,2h,4h,8h
Added 3h, 14D
Changed 1w is now 7D
All days are now big D
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--------------------------------Wallet Format:--------------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The rows will be of the following format:
Currency, Amount, Bought Price, Bought Date
Currency => example is BTC, not to include pair here
Amount => example is 1 or 2.5, maximum 8 significant figures
Bought Price => Price the currency was bought for
Bought Date => Date the currency was bought
The above information will be used to determine max worth, PnL trend, etc.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
----------------------------Wallet History Format:----------------------------
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The rows will be of the following format:
Currency, Date, Amount, Price, buy/sell
Most recent will be at the bottom