Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
zaifbotのlt
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
英 谷口
May 07, 2017
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
zaifbotのlt
英 谷口
May 07, 2017
More Decks by 英 谷口
See All by 英 谷口
plasma.pdf
akira_taniguchi
1
700
pycon mini osaka 発表資料:ethereum
akira_taniguchi
1
930
How_To_ Introduce_TradingView
akira_taniguchi
1
910
OAuth2の資料
akira_taniguchi
0
4.9k
pycon2016_zaif
akira_taniguchi
0
290
pyconjp 2016 ライトニング用(未確定)
akira_taniguchi
1
270
test pdf
akira_taniguchi
0
110
PyConJP 2015 スライド資料
akira_taniguchi
0
170
Featured
See All Featured
Navigating Team Friction
lara
192
16k
Building Applications with DynamoDB
mza
96
7.1k
Balancing Empowerment & Direction
lara
6
1.2k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
540
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Everyday Curiosity
cassininazir
0
240
Writing Fast Ruby
sferik
630
63k
Designing for Timeless Needs
cassininazir
1
260
Game over? The fight for quality and originality in the time of robots
wayneb77
1
210
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
160
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
Transcript
Ծ௨՟ͷ औҾϥΠϒϥϦΛ ࡞ͬͯΈͨ
Ծ௨՟औҾॴɾ;BJG
ˢ ɹ͜ˠ Ε
ڥߏங
QZWFOWWFOW TPVSDFWFOWCJOBDUJWBUF WFOW QJQJOTUBMM[BJGCPU WFOW JOJU@EBUBCBTF
ѻ͑Δ௨՟ϖΞΛ औಘ͍ͨ͠
௨՟ϖΞͱʁ औҾ͢Δ௨՟ͷΈ߹Θͤ
ϏοτίΠϯ ԁ ˣ CUD@KQZ
.0/" ԁ ˣ NPOB@KQZ
from zaifbot.modules.api.cache import ZaifCurrencyPairs zaif = ZaifCurrencyPairs() print(zaif.all) #ZaifͰѻ͑Δͯ͢ͷ௨՟ϖΞใΛऔಘ
print(zaif[‘btc_jpy']) #௨՟ϖΞΛࢦఆ͢Εɺ୯ମͷใΛऔಘ >> [{‘aux_unit_step': 5.0 ʙʙʙ͍ͷͰলུʙʙʙ 'currency_pair': ‘btc_jpy'}] >> { >> 'aux_unit_step': 5.0, >> 'event_number': 0, >> 'item_unit_step': 0.0001, >> 'description': 'ϏοτίΠϯɾຊԁͷऔҾΛߦ͏͜ͱ͕Ͱ͖·͢', >> 'name': 'BTC/JPY', >> 'is_token': False, >> 'aux_unit_min': 5.0, >> 'title': 'BTC/JPY', >> 'item_unit_min': 0.0001, >> 'currency_pair': ‘btc_jpy' >> }
ऴΛऔಘ͍ͨ͠
from time import sleep from zaifbot.modules.utils import get_current_last_price print(get_current_last_price('btc_jpy'))
#औಘ͍ͨ͠currency_pairΛࢦఆ print(get_current_last_price('mona_jpy')) sleep(30) print(get_current_last_price('btc_jpy')) #ϦΞϧλΠϜͰऔಘՄೳ print(get_current_last_price('mona_jpy')) >> {'last_price': 165800.0, 'timestamp': '2017-05-02 18:17:55.322019'} >> {'last_price': 15.3, 'timestamp': '2017-05-02 18:17:56.533959’} ʙʙ30ඵޙʙʙ >> {'last_price': 165830.0, 'timestamp': '2017-05-02 18:18:26.415696'} >> {'last_price': 15.3, 'timestamp': '2017-05-02 18:18:22.328562’}
ҠಈฏۉઢΛ औಘ͍ͨ͠
Ҡಈฏۉઢͱʁ ҰఆظؒͷฏۉՁ֨Λ ʑܭࢉͯ͠ग़ͨ͠ʮ͑ʯΛ ઢͰͭͳ͍ͩͷ
ৄ͘͠Πϯϕελʔ;Ͱ
from zaifbot.moving_average import get_sma, get_ema print(get_sma()) #୯७Ҡಈฏۉઢऔಘ print(get_ema()) #ࢦҠಈฏۉઢऔಘ
>> [{'time_stamp': 1408719600, 'close': 53000.0, 'moving_average': 53410.0, 'closed': True}, {'time_stamp': 1408806000, 'close': 53900.0, 'moving_average': 54090.0, 'closed': True}] >> [{'time_stamp': 1408287600, 'close': 47001.0, 'moving_average': 50702.24516926622, 'closed': True}, {'time_stamp': 1408374000, 'close': 50500.0, 'moving_average': 50634.83011284415, 'closed': True}]
࣮ࡍʹτϨʔυ͍ͨ͠
None
from zaifbot.modules.api.wrapper import BotTradeApi key = '࡞ͨ͠key' secret
= '࡞ͨ͠secret' api = BotTradeApi(key, secret) trade_result = api.trade(currency_pair='btc_jpy', action='bid', price=180000, amount=2) print(trade_result) >> { >> "received": 0.1, >> "remains": 0, >> "order_id": 354323, >> "funds": { >> "jpy": 325, >> "btc": 1.392, >> "mona": 2600 >> } >> }
ϝϦοτ Τϥʔ࣌ࣗಈϦτϥΠ OPODFࣗಈ༩
༨ܭͳจΛࣗಈͰ Ωϟϯηϧ͍ͨ͠
DBTF ࠓ͙͢ചΓ͍ͨͷʹ จ͕ྲྀΕ͍ͯͬͯ͠·͏ DBTF ࠷ऴͱΕ͗ͯ͢ɺ ͍ͭ·Ͱͨͬͯఆ͠ͳ͍
from zaifbot.modules.api.wrapper import BotTradeApi from zaifbot.modules.api.order import AutoCancelClient
key = '࡞ͨ͠key' secret = '࡞ͨ͠secret' api = BotTradeApi(key, secret) trade_result = api.trade(currency_pair='btc_jpy', action='bid', price=180000, amount=2) order_id = trade_result['order_id'] auto_canceler = AutoCancelClient(api) # ࠷ऴஈ͔Β10000ԁΕͨΒࣗಈͰΦʔμʔऔΓফ͠ auto_canceler.cancel_by_price(order_id, 'btc_jpy', 10000) # ̍࣌ؒఆ͠ͳ͔ͬͨΒࣗಈͰΦʔμʔऔΓফ͠ auto_canceler.cancel_by_time(order_id, 'btc_jpy', 3600) # ΞΫςΟϒͳࣗಈऔΓফ͠ઃఆͷΦʔμʔҰཡ active_cancel_orders = auto_canceler.get_active_cancel_orders() for active_cancel_order in active_cancel_orders: print(active_cancel_order) >> {‘id’: ‘583hjf7whj345’, ‘cancel_type’: ‘by_time’ ʙলུʙ} # ࣗಈऔΓফ͠ΛΩϟϯηϧ auto_canceler.stop_cancel(active_cancel_orders[0]['id'])
ৄ͘͜͜͠ (JU)VCɿIUUQTHJUIVCDPNUFDICVSFBV[BJGCPU "1*υΩϡϝϯτɿ IUUQTUFDICVSFBVBQJEPDVNFOUSFBEUIFEPDTJPKB MBUFTUJOEFYIUNM
ࠓ1Z$POΓ·͢
τʔΫٴͼϙελʔืू