Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
940
How_To_ Introduce_TradingView
akira_taniguchi
1
930
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
Fireside Chat
paigeccino
43
4k
Producing Creativity
orderedlist
PRO
348
41k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Building Applications with DynamoDB
mza
96
7.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
Rails Girls Zürich Keynote
gr2m
96
14k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
360
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
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Γ·͢
τʔΫٴͼϙελʔืू