urbit/mar/bit/api-call.hoon
Anton Dyudin ac98cf1075 Sur disqualification moved to userspace
sed -i'' -e '/^|/{x;/./{p;s/.*//;};x;};/ *\\/-.*\\*/{h;s/ //g;s/,[a-z]*//g;s/^[^a-z]*/[/;s/ *::.*$//;s/$/ .]/;s/*/ /g;x;s/\\*//g;}' urb/zod/**.{hoon,hook}
  Followed by manual fixes where e.g. the file didn't start with a core
2015-09-01 14:02:19 -07:00

32 lines
764 B
Plaintext

::
:::: /hoon/bit-api-call/mar
::
/? 314
/- bit-api
[bit-api .]
|_ [access-token=@t req=bit-api-call]
::
++ wrap
|= [end-point=path req=$|(%get [%post p=json])]
[/com/coinbase/sandbox/api v1/end-point req ~ ['access_token' access-token]~]
::
++ 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 ~))
==
--
--