shrub/mar/bit/api-call.hoon

32 lines
764 B
Plaintext
Raw Normal View History

2015-05-29 02:07:03 +03:00
::
2015-06-05 03:27:01 +03:00
:::: /hoon/bit-api-call/mar
2015-05-29 02:07:03 +03:00
::
/? 314
/- bit-api
[bit-api .]
2015-05-29 02:07:03 +03:00
|_ [access-token=@t req=bit-api-call]
::
++ wrap
|= [end-point=path req=$|(%get [%post p=json])]
2015-05-30 01:05:47 +03:00
[/com/coinbase/sandbox/api v1/end-point req ~ ['access_token' access-token]~]
2015-05-29 02:07:03 +03:00
::
++ order
|= [amount=@t currency=@t] ^- json
(jobe qty/s/amount ?~(currency ~ [currency/s/currency ~]))
++ grow
|% ++ httpreq
%- wrap
|-
?- -.req
%list [/accounts %get]
%buy [/buys %post (order +.req)]
%sell [/sells %post (order +.req)]
%send $(req [%txt-send (rsh 3 2 (scot %uc adr.req)) btc.req])
%txt-send
:+ /transactions/'send_money' %post
(joba %transaction (jobe to/s/to.req amount/s/btc.req ~))
==
--
--