-
Notifications
You must be signed in to change notification settings - Fork 0
/
KoreanPremiumScanner.py
61 lines (44 loc) · 1.44 KB
/
KoreanPremiumScanner.py
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
#-*- coding: utf-8 -*-
import requests
from forex_python.converter import CurrencyRates
#logging.basicConfig(level=logging.DEBUG)
c = CurrencyRates()
def get_upbit_price(coinName):
headers = {
'User-Agent': 'kope bot v1.0',
}
r = requests.get(url="https://crix-api-endpoint.upbit.com/v1/crix/candles/minutes/1?code=CRIX.UPBIT."+coinName, headers=headers)
print (r)
a = r.json()
c = a[0]
print (c)
return c["tradePrice"]
def get_kope(coinName="BTC"):
ticker = get_upbit_price('KRW-'+coinName.upper())
btckrw_upbit = float( ticker )
print( 'upbit',coinName,'krw :', btckrw_upbit )
r = requests.get(url='https://api.bitfinex.com/v1/ticker/'+coinName.lower()+'usd')
btcusd = float( r.json()['last_price'] )
print( 'bitfinex',coinName,'usd :', btcusd )
usdkrw = float( c.get_rate('USD', 'KRW') )
print( 'usdkrw :', usdkrw )
btckrw_bitfinex = btcusd * usdkrw
print( 'bitfinex',coinName,'krw :' , btckrw_bitfinex )
kope = (btckrw_upbit / btckrw_bitfinex) - 1
print( coinName,'kope :', '{:.3%}'.format(kope) )
#print( coinName,'kope :', kope)
return btcusd
"""
coinName = "BTC"
ticker = get_upbit_price('KRW-'+coinName.upper())
btckrw_upbit = float( ticker )
print( 'upbit',coinName,'krw :', btckrw_upbit )
"""
get_kope("btc")
#get_kope("eth")
#get_kope("xrp")
#get_kope("eos")
#get_kope("trx")
#get_kope("xlm")
#get_kope("snt")
#get_kope("neo")