Python - bitfinex public APIメモ - ticker、trades取得

## bitfinex public APIを用いてtickerとtradesを取得

登録(API_KEY、API_SECRETの取得)は不要

### ticker

```python
import requests

endpoint_fmt = 'https://api.bitfinex.com/v2/{}/'
currency_pair = 'tBTCUSD'
ret = requests.get(endpoint_fmt.format('ticker') + currency_pair)
print(ret.json())
```

```
[3764.5, 73.94068922, 3765.2, 87.18142364, 63.2, 0.0171, 3765.3, 39573.74316814, 3782, 3465.1]
```

返却値
https://bitfinex.readme.io/v2/reference#rest-public-ticker

### trades 

```python
import requests

endpoint_fmt = 'https://api.bitfinex.com/v2/{}/'
currency_pair = 'tBTCUSD'
ret = requests.get(endpoint_fmt.format('trades') + currency_pair + '/hist')
print(ret.json())
```

```
[[67889520, 1505671908000, 0.0611295, 3760], [67889519, 1505671908000, 0.01959586, 3760], [67889516, 1505671907000, -0.04895, 3759.5], [67889515, 1505671907000, -0.05105, 3759.8], [67889511, 1505671906000, -0.21985, 3759.6], [67889510, 1505671906000, -0.01, 3759.6], [67889508, 1505671906000, -0.02, 3761.8], [67889509, 1505671906000, -0.02015, 3759.6], [67889507, 1505671906000, 0.02, 3762.8], [67889506, 1505671906000, 0.0116, 3762.8], [67889505, 1505671906000, -0.015, 3763.1], [67889504, 1505671906000, -0.02, 3763.2], [67889503, 1505671906000, -0.05105, 3763.8], [67889502, 1505671906000, -0.02, 3764.5], [67889501, 1505671906000, -0.02, 3764.5], [67889500, 1505671906000, -0.02, 3764.5], [67889498, 1505671906000, -0.02, 3764.5], [67889499, 1505671906000, -0.02, 3764.5], [67889497, 1505671905000, -0.02, 3764.5], [67889496, 1505671905000, -0.02, 3764.5], [67889495, 1505671905000, -0.02, 3764.5], [67889494, 1505671905000, -0.02, 3764.5], [67889493, 1505671905000, -0.02, 3764.5], [67889492, 1505671905000, -0.01035073, 3764.5], [67889489, 1505671905000, -0.00753573, 3764.5], [67889490, 1505671905000, -0.00964927, 3764.5], [67889488, 1505671904000, -0.006, 3764.5], [67889484, 1505671902000, 0.011, 3765.3], [67889480, 1505671899000, 0.02, 3765.6], [67889473, 1505671898000, 0.011, 3765.8], [67889470, 1505671898000, 0.008, 3765.8], [67889469, 1505671898000, 0.003, 3764.6], [67889468, 1505671897000, 0.011, 3764.6], [67889466, 1505671897000, 0.011, 3764.6], [67889461, 1505671897000, 0.011, 3764.6], [67889458, 1505671897000, 0.011, 3764.6], [67889457, 1505671897000, 0.02, 3764.6], [67889455, 1505671897000, 0.011, 3764.6], [67889454, 1505671897000, 0.011, 3764.6], [67889452, 1505671897000, 0.011, 3764.6], [67889451, 1505671890000, 0.011, 3766.8], [67889449, 1505671890000, -0.02, 3764.5], [67889450, 1505671890000, -0.00646427, 3764.5], [67889446, 1505671890000, -0.02, 3764.5], [67889448, 1505671890000, -0.02, 3764.5], [67889447, 1505671890000, -0.02, 3764.5], [67889445, 1505671890000, -0.02, 3764.5], [67889444, 1505671890000, -0.02, 3764.5], [67889443, 1505671890000, -0.02, 3764.5], [67889442, 1505671890000, -0.02, 3764.5], [67889440, 1505671890000, -0.0132, 3766.6], [67889439, 1505671890000, -0.02, 3766.7], [67889441, 1505671890000, -0.149636, 3766], [67889438, 1505671890000, 0.011, 3766.8], [67889437, 1505671890000, 0.28102605, 3766.9], [67889436, 1505671890000, 1, 3766.8], [67889435, 1505671890000, 0.1, 3766.8], [67889434, 1505671890000, 0.478, 3766.8], [67889431, 1505671890000, 0.011, 3766.8], [67889430, 1505671889000, 0.011, 3766.8], [67889429, 1505671889000, 0.011, 3767.3], [67889428, 1505671888000, 0.011, 3767.2], [67889427, 1505671888000, 0.011, 3767.2], [67889426, 1505671887000, 0.011, 3767.3], [67889421, 1505671887000, 0.011, 3767.4], [67889419, 1505671886000, 0.02, 3767.4], [67889416, 1505671886000, 0.011, 3767.5], [67889415, 1505671886000, 0.02, 3767.5], [67889414, 1505671885000, 0.011, 3766.9], [67889413, 1505671885000, 0.011, 3767], [67889412, 1505671885000, 0.00097268, 3767.2], [67889411, 1505671885000, 0.01002732, 3767.1], [67889397, 1505671878000, 0.011, 3767.2], [67889394, 1505671878000, 0.64237527, 3767.2], [67889393, 1505671878000, 2.111754, 3767.2], [67889392, 1505671878000, 0.01372273, 3767.1], [67889391, 1505671878000, 0.011, 3767.2], [67889390, 1505671877000, 0.011, 3767.2], [67889389, 1505671877000, 0.011, 3767.3], [67889386, 1505671876000, 2, 3767.3], [67889385, 1505671876000, 0.011, 3767.3], [67889384, 1505671875000, 0.011, 3767.4], [67889383, 1505671875000, 0.011, 3767.4], [67889381, 1505671875000, 0.011, 3767.4], [67889379, 1505671874000, 0.011, 3767.4], [67889376, 1505671872000, 0.03322814, 3766.7], [67889372, 1505671871000, 0.729205, 3766.8], [67889368, 1505671870000, 0.011, 3766.9], [67889364, 1505671870000, 0.00633202, 3766.9], [67889363, 1505671870000, 0.01366798, 3766.9], [67889362, 1505671869000, 0.011, 3767], [67889361, 1505671869000, 0.011, 3767], [67889354, 1505671868000, 0.011, 3767], [67889350, 1505671867000, 0.011, 3767.4], [67889348, 1505671866000, 0.011, 3767.4], [67889347, 1505671866000, 0.011, 3767.5], [67889345, 1505671866000, 0.011, 3767.5], [67889344, 1505671865000, 0.011, 3767.5], [67889343, 1505671865000, 0.00410053, 3767.6], [67889342, 1505671865000, 0.00689947, 3767.6], [67889340, 1505671864000, -0.0068, 3766.6], [67889339, 1505671864000, 0.011, 3767.6], [67889336, 1505671864000, 0.011, 3767.7], [67889335, 1505671863000, 0.011, 3767.7], [67889334, 1505671863000, 0.011, 3767.7], [67889331, 1505671863000, 0.011, 3767.9], [67889330, 1505671863000, 0.011, 3767.9], [67889329, 1505671863000, 0.011, 3767.9], [67889328, 1505671862000, 0.011, 3768.1], [67889326, 1505671861000, 0.5, 3766.3], [67889325, 1505671861000, 0.011, 3766.3], [67889323, 1505671861000, 0.011, 3766.3], [67889322, 1505671861000, 0.011, 3766.3], [67889321, 1505671860000, 0.011, 3766.4], [67889320, 1505671860000, 0.011, 3766.5], [67889319, 1505671860000, 0.011, 3766.6], [67889318, 1505671859000, 0.011, 3766.5], [67889317, 1505671859000, 0.011, 3766.5], [67889316, 1505671859000, 0.011, 3766.6], [67889315, 1505671858000, 0.011, 3766.7]]
```

返却値
https://bitfinex.readme.io/v2/reference#rest-public-trades