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
英 谷口
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
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
640
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
330
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
380
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Γ·͢
τʔΫٴͼϙελʔืू