YOLOdice API documentation

Code and play dice like a pro

On 15th January 2018 YOLOdice added support for LTC. Some methods require an additional parameter coin. If not provided, the endpoint might return Invalid Parameters or Object Invalid error.

If you are migrating from a pre-multicoin API, note that there are now multiple site_data objects, one per supported coin. Users now have user_coin_data that store coin-specific data, one per each coin.

YOLOdice is a fast, Bitcoin-based dice game.

The Ruby client library is available at github.com/ethan-nx/yolodice-client.

Protocol

YOLOdice API follows the specification of JSON-RPC 2.0. The exect details follow:

The default endpoint is api.yolodice.com:4444. All connections that do not authenticate within a required time frame are closed.

An example message exchange with API endpoint might look like this:

[Connected to yolodice.dev:4444]
[Requesting auth challenge]
>>> {"id":0,"method":"generate_auth_challenge"}
<<< {"id":0,"result":"yd_login_27M2T2auCMEu"}

[Authenticating]
>>> {"id":1,"method":"auth_by_address","params":{"address":"n3kmufwdR3Zzgk3k6NYeeLBxB9SpHKe5Tc","signature":"H4W6yMaVK6EzrTw/9jqmLh1lvoyFnxCFqRon2g25lJ7FTCAUHGJWWF3UJD5wCzCVafdjIfCmIYH2KyHboodjjcU="}}
<<< {"id":1,"result":{"id":1,"name":"ethan_nx"}}

[Reading site data]
>>> {"id":3,"method":"read_site_data"}
<<< {"id":3,"result":{"bets":236689,"wins":83838,"losses":152851,"win_amount_sum":608533415628,"max_bet_profit":142339372,"balance":28171774406,"balance_total":28467874406,"profit":15136442746,"wagered":907016014443,"luck":0.004865027117510179,"at_bet_id":236689,"updated_at":1485780604.8089,"created_at":1470085904.6898}}

[Calling a non-existing method]
>>> {"id":4,"method":"foobar_method"}
<<< {"id":4,"error":{"code":-32601,"message":"Method not found"}}

API keys

API keys are generated per-user and can have individual permissions attached. Whats new in the authentication setup is that we use the Bitcoin private key and address and message signing for authentication. Each API key consists of:

Adding the new key to a user account involves the following steps:

  1. the client generates a new Bitcoin private key and a corresponding address,
  2. user adds a new API key in his Account settings,
  3. for this new key the user inserts the Bitcoin address generated in step 1 and sets permissions.

Authenticating

Each connection to the API endpoint must be immediately authenticated, otherwise it will be dropped. To authenticate:

  1. request an authentication challenge message via generate_auth_challenge,
  2. sign the message using the private key,
  3. use auth_by_address method to authenticate.

Permissions

The following permission groups are available for each API key:

Methods that do not require any permission do not list any.

2FA codes are not required for API requests. If you have login/withdrawal/playing or any other actions protected by 2FA in the web interface it has no effect on API requests.

Request rate limit

Some operations have cooldown attached. E.g. the create_seed method has a 10s delay. If you call create_seed and then after 2s you call it again, the second execution will have 8s delay. If the number of requests you are sending is far beyond what we think is acceptable, you will get a 499: Too many requests error.

Conventions

Wherever the coin amount is sent or received, it is passed as an integer and equals the amount of 1/100,000,000th of the coin (1e-8, an equivalent of a satoshi for Bitcoin and lit for Litecoin). 1 BTC would then be passed as an integer 100000000. This holds true for other coins, even if their smallest atomic amount is smaller. The smallest atomic unit of any coin is 1e-8. So whenever we specify the result type as "satoshis", we mean an integer equal to number of 1e-8 units..

Whenever a date is accepted or returned, it's coded as a float specifying number of seconds since the UNIX epoch (aka UNIX time). Dates are always given in UTC timezone.

IDs are generally unique across the site, e.g. two users cannot have a bet with the same bet_id.

Errors

Whenever a request cannot be completed server will resond with an message containing an error object.

The following errors can be returned:

Protocol-related errors

-32700 Parse error Returned when JSON parser cannot decode the message.
-32600 Invalid request Returned when the request is not a valid JSON-RPC object.
-32601 Method not found The method specified in the request object does not exist.
-32602 Invalid params Parameters specified for the given method are not OK.
-32603 Internal error An error occured in our code, this should not happen.

HTTP-like errors (RESTful heritage)

403 Forbidden User (or API key) does not have permission to call this method or access the data.
404 Not found Returned when requested object cannot be found.
405 Method not allowed This is returned when the method is called outside of its context, e.g. an authentication method is called after the user has already authenticated.
422 Object invalid Returned when the requests tries to create or patch an object, but the attributes passed make the object fail validation. The response usually contains a data field with additional information about the invalid attributes.
499 Too many requests Thrown when client sends too many requests. In such a case reduce the request rate.

Application-specific errors

1002 Auth message not generated Returned when auth_by_address is called without calling generate_auth_challenge.
1005 Bet in progress Another bet by the same user is currently being rolled.
1008 Operations suspended Due to integrity checks failed some operations (including creating bets, withdrawing, investment-related operations) are suspended until YOLOdice systems are green again.
1010 Max number of investments reached User has already 10 investments and cannot create a new one.

For example, calling the read_user_data without parameters will result in the following error:

>>> {"id":3,"method":"read_user_data"}
<<< {"id":3,"error":{"code":-32602,"message":"Parameters invalid"}}

422 Object invalid is returned when patching or creating an object with invalid attributes, e.g.

>>> {"id":6,"method":"create_bet","params":{"attrs":{"amount":-1,"range":"low"}}}
<<< {"id":6,"error":{"code":422,"message":"Object invalid","data":{"errors":{"target":"is not present","range":"is not in range or set: [\"lo\", \"hi\"]","amount":"is less than 0"}}}}

Methods

API methods take an array or hash (object) as parameters. If a method does not require any parametes, the params request member can be ommited.

If a method accepts a hash, this document specifies its fields directly in the method signature.

You might notice that the API structure is similar to a RESTful API and you are right. Methods starting with read_ correspond to HTTP GET requests, create_ to PUT or POST, list_ to GET on a collection resource and patch_ to PATCH. Object's ID (when reading or patching) is usually located in selector.id, while the attributes to be saved are in attrs.

Authentication

generate_auth_challenge()
Returns
  • an authentication challenge string.
auth_by_address({address: address, signature: signature})
Parameters
  • address (string) — the Bitcoin address associated with the API key,
  • signature (string) — the result of signing the challenge string with the private part of the Bitcoin address.
Returns
  • false — if authentication fails,
  • hash containing user data — if authentication succeeds.

Site-related data (read-only)

read_site_data({selector: {id: coin)
Parameters
  • id (string) — coin, e.g. "btc" or "ltc",
Returns
  • a hash containing the site object data for a given coin with fields:
    • id (string) — coin, e.g. "btc" or "ltc",
    • bets (integer) — number of bets up to now,
    • wins (integer) — number of winning bets so far,
    • losses (integer) — number of losing bets so far,
    • win_sum_amount (satoshis) — summed ammounts of winning bets,
    • max_bet_profit (satoshis) — max profit per bet,
    • balance (satoshis) — bankroll,
    • profit (satoshis) — site profit so far,
    • wagered (satoshis) — wagered up to date,
    • luck (float) — overall players' luck, scaled -1..1 (multiply 100 to get percents),
    • at_bet_id (integer) — id of the most recent bet when generating this site data object,
    • updated_at (date) — date of the most recent update to site data values,
    • created_at (date) — date of the first bet on site.
An example of the returned object would be:
{"bets":236689,"wins":83838,"losses":152851,"win_amount_sum":608533415628,"max_bet_profit":142339372,"balance":28171774406,"profit":15136442746,"wagered":907016014443,"luck":0.004865027117510179,"at_bet_id":236689,"updated_at":1485780604.8089,"created_at":1470085904.6898}
list_site_datas()
Returns

The method returns an array of site datas for all supported coins. Hash format is identical to this returned by read_site_data.

User-related

read_user({selector: {id: id}})
Parameters
  • id (integer) — an ID of the user
Returns
  • a hash containing the user object with the following attributes:
    • id (integer) — user ID,
    • name (string) — user nick name,
    • level (integer) — user level,
    • stars (string) — a string that encodes user stars (related to user level); currently supported stars are g (gold), s (silver) and b brown; a string equal to "sss" means three silver stars,
    • image (string) — image hash if user has a profile image uploaded; in order to construct an URL for the profile image do this: "https://yolodice.com/pimg/IMAGE_HASH".
    • created_at (date) — date when user was created,
    • roles (array of strings) — a list of roles user has; possible values are admin or mod,

Attributes that are null are not included in the result.

An example of calling this method on a user:

>>> {"id":4,"method":"read_user","params":{"selector":{"id":50}}}
<<< {"id":4,"result":{"id":50,"name":"Refugio","created_at":1481911070.7298, "roles": ["mod"]}}
read_user_data({selector: {id: id}})
Parameters
  • id (integer) — an ID of the user
Returns
  • a hash containing the user-data object that can contain the following fields:
    • id (integer) — user ID,
    • bets (integer) — number of bets of a user,
    • wins (integer) — number of winning bets of a user,
    • losses (integer) — number of losing bets of a user,
    • luck (float) — overall players' luck, scaled -1..1 (multiply 100 to get percents),
    • chat_message_count (integer) — number of chat messages of a user,

An example of calling this method on yourself:

>>> {"id":3,"method":"read_user_data","params":{"selector":{"id":1}}}
<<< {"id":3,"result":{"id":1,"bets":207231,"wins":69072,"losses":138159,"profit":-11124367553,"profit_max":2967764799,"profit_min":-11124367553,"wagered":807278534181,"luck":0.003180315905825429,"chat_message_count":144}}

The balance attribute is present only if you call the method on your own account. You cannot read anyone else's balance.

read_user_coin_data({selector: {id: id}})
Parameters
  • id (string) — a string composed of user_id and coin in the following way: "user_id_coin"; e.g. to get user coin data for user_id = 1 and coin "btc" the id would be "1_btc".
Returns
  • a hash containing the user-data coin object that can contain the following fields:
    • id (string) — a string composed of user_id and coin as in the parameters,
    • user_id (integer) — user ID,
    • coin (string) — coin, e.g. "btc" or "ltc",
    • bets (integer) — number of bets of a user,
    • wins (integer) — number of winning bets of a user,
    • losses (integer) — number of losing bets of a user,
    • wagered (satoshis) — user's wagered up to date,
    • profit (satoshis) — user's profit so far,
    • profit_min (satoshis) — user's lowest profit ever,
    • profit_max (satoshis) — user's highest profit ever,
    • luck (float) — overall players' luck, scaled -1..1 (multiply 100 to get percents),
    If you request this object as the owner, additional fields are:
    • balance (satoshis) — user balance (exists only if requesting data for you own account).
    • bets_s (integer) — number of bets of a user in the session,
    • wins_s (integer) — number of winning bets of a user in the session,
    • losses_s (integer) — number of losing bets of a user in the session,
    • wagered_s (satoshis) — user's wagered up to date in the session,
    • profit_s (satoshis) — user's profit in the session,
  • Session counters are resettable counters presented for user convenience. The user can reset its session counters by calling reset_session_counters method.

    If you are requesting user coin data and the owner has enabled some privacy options, some of the fields might not be available.

An example of calling this method on yourself:

>>> {"id":3,"method":"read_user_data","params":{"selector":{"id":"1_btc"}}}
<<< {"id":3,"result":{"id":"1_btc","user_id": 1,"coin":"btc","bets":207231,"wins":69072,"losses":138159,"profit":-11124367553,"profit_max":2967764799,"profit_min":-11124367553,"wagered":807278534181,"luck":0.003180315905825429,"balance":1260580757, "bets_s": 10,"wins_s":6,"losses_s":4,"wagered_s":15643,"profit_s":20043}}
list_user_coin_datas({user_id: user_id})
Parameters
  • user_id (integer) — ID of the user.
Returns

The method returns an array of coin datas for the given user. The format is identical to read_user_coin_data.

reset_session_counters()
Requires permissions: play
Parameters
  • coin (string) — name of the coin, not required
Returns
Method returns true on success.

The method clears session counters in user_coin_data. If the coin parameter is present, only counters for the given coin are reset.

Bets

A few notes about bets first. It's important to note that the primary attributes of a bet that determine if it's a winning/losing bet and bet profit are: amount, target, range and rolled.

multiplier, profit, win_probability (aka chance) can be directly derived from the primary attributes.

Please consult YOLOdice Freqently Asked Questions for more details.

create_bet({attrs: attrs, include_datas: include_datas})
Requires permissions: play
Parameters
  • attrs (hash) — hash containing attributes of a bet:
    • coin (string) — coin, e.g. "btc" or "ltc",
    • amount (satoshis) — amount of a bet,
    • target (integer) — an integer from 1..989900 range (inclusive),
    • range (string) — roll range, can be 'lo' or 'hi'
  • include_datas (boolean) (optional) — if true, the response will include current site data and user data objects.
Returns
  • a hash containing the attributes of the bet:
    • id (integer) — bet ID,
    • user (hash) — a hash containing basic info about the user (you!):
      • id (integer) — user ID,
      • name (string) — user name,
    • coin (string) — coin, e.g. "btc" or "ltc",
    • created_at (date) — server time the bet was created,
    • target (integer) — target of the bet,
    • range (string) — range of the bet, 'lo' or 'hi',
    • amount (satoshis) — amount of the bet,
    • rolled (integer) — the result rolled from 0..999999 range (inclusive),
    • profit (satoshis) — profit of the bet,
    • seed_id (integer) — ID of the seed used,
    • nonce (integer) — bet nonce used to generate the result,
    • delay (float) — this field will be present if there was server-side delay added to the bet; the delay (in seconds) is added to small bets only.
    If include_datas was set to true, the hash will contain the following attributes:
    • user_data (hash) — a hash containing current user data, as would be returned by read_user_data,
    • user_coin_data (hash) — a hash containing current user coin data, as would be returned by read_user_coin_data,
    • site_data (hash) — a hash containing current site data for the given coin, as would be returned by read_site_data.

An example of calling this method to create a 100-satoshis bet:

>>> {"id":340,"method":"create_bet","params":{"attrs":{"amount":100,"range":"lo","target":100}}}
<<< {"id":340,"result":{"id":237033,"user":{"id":1,"name":"ethan_nx"},"seed_id":156,"created_at":1486403141.4738,"target":100,"range":"lo","amount":100,"rolled":460913,"profit":-100,"nonce":344}}
read_bet({selector: {id: id})
Parameters
  • id (integer) — an ID of the bet
Returns
  • a hash containing the attributes of the bet:
    • id (integer) — bet ID,
    • user (hash) — a hash containing basic info about the user:
      • id (integer) — user ID,
      • name (string) — user name,
    • coin (string) — coin, e.g. "btc" or "ltc",
    • created_at (date) — server time the bet was created,
    • target (integer) — target of the bet,
    • range (string) — range of the bet, 'lo' or 'hi',
    • amount (satoshis) — amount of the bet,
    • rolled (integer) — the result rolled from 0..999999 range (inclusive),
    • profit (satoshis) — profit of the bet,
    • seed_id (integer) — ID of the seed used,
    • nonce (integer) — bet nonce used to generate the result.
  • If owner of the bet has privacy options set (anonimizing bets), you will not get user details for this bet.

list_bets({user_id: user_id, order: order, id_marker: id_marker, limit: limit})
Parameters
  • user_id (integer, optional) — ID of the user; if present, only bets made by the user will be returned,
  • order (string, optional) — specifies sorting of the results, accepted values 'asc' (ascending by bet id) or 'desc' (descending by bet id); default: 'desc'
  • id_marker (integer, optional) — if order is 'asc', only bets with id > id_marker are returned; if order is 'desc', only bets with id < id_marker are returned
  • limit (integer, optional) — limits number of objects returned; default: 100, max: 1000
Returns
  • an array of hashes, each hash contains attributes of a single bet as returned by read_bet.

order, id_marker and limit can be used to paginate through available bets. I advise to always specify order.

Seeds

read_seed({selector: {id: id})
Parameters
  • id (integer) — an id of the seed
Returns
  • a hash containing the attributes of the seed:
    • id (integer) — seed id,
    • user_id (integer) — id of the user the seed belongs to,
    • created_at (date) — server time the seed was created,
    • bet_count (integer) — number of bets generated using this seed,
    • client_seed (string) — client-provided part of the seed,
    • current (boolean) — true if the seed is current, false if it's archived,
    • secret_hashed (string) — hex-encoded SHA256 hash of the server seed,
    • secret (string) — hex-encoded server-side part of the seed; this field is not present in current seeds.
read_current_seed({selector: {user_id: user_id})
Parameters
  • user_id (integer) — id of the user you want to read the seed,
Returns

Method returns a hash containing attributes of the current seed for the given user. The output is identical to read_seed method.

list_seeds({user_id: user_id, order: order, id_marker: id_marker, limit: limit})
Parameters
  • user_id (integer, optional) — ID of the user; if present, only seeds of this user will be returned,
  • order (string, optional) — specifies sorting of the results, accepted values 'asc' (ascending by seed id) or 'desc' (descending by seed id); default: 'desc'
  • id_marker (integer, optional) — if order is 'asc', only seeds with id > id_marker are returned; if order is 'desc', only seeds with id < id_marker are returned
  • limit (integer, optional) — limits number of objects returned; default: 100, max: 1000
Returns
  • an array of hashes, each hash contains attributes of a single seed as returned by read_seed.
create_seed({attrs: attrs})
Requires permissions: play
Parameters
  • attrs (hash) — hash containing attributes of a seed:
    • client_seed (string) — user-provided part of the seed; if missing, server will choose random words to fill the client_seed.
Returns

Method returns a hash containing attributes of the current seed for the given user. The output is identical to read_seed method.

Unless the previous seed has bets, this method will return a 422: Object invalid error.

This method must be called to reveal secret part another active seed. This way the previous seed would enter the "archived" state and the secret would be available.

patch_seed({selector: {id: id}, attrs: attrs})
Requires permissions: play
Parameters
  • id (integer) — an id of the seed
  • attrs (hash) — hash containing attributes of a seed:
    • client_seed (string) — user-provided part of the seed, between 6 and 128 chars, only [a-zA-Z0-9 \-_] chars are allowed; if missing, server will choose random words to fill the client_seed.
Returns

Method returns a hash containing attributes of the current seed for the given user. The output is identical to read_seed method.

client_seed can only be changed when seed has no bets yet. Otherwise, an error would be returned.

Deposits

read_deposit_address({coin: coin})
Requires permissions: deposit
Parameters
  • coin (string)
Returns

Method returns a hash containing attributes of the current deposit address for the autenticated user:

  • id: internal id for the deposit address,
  • user_id: id of the owner of this address,
  • coin,
  • address: the Bitcoin address connected to the account; any deposit made to this address will be credited to user balance,
  • created_at (date) — date this address was created.
list_deposit_addresses({coin: coin})
Requires permissions: deposit
Parameters
  • coin (string)
Returns

Method returns all user deposit addresses for the given coin.

  • id: internal id for the deposit address,
  • user_id: id of the owner of this address,
  • coin,
  • address: the Bitcoin address connected to the account; any deposit made to this address will be credited to user balance,
  • created_at (date) — date this address was created,
  • current — this is set to true if the address is current (latest).
read_deposit({selector: {id: id}})
Requires permissions: deposit or history
Parameters
  • id (integer) — an id of the deposit
Returns
  • a hash containing the attributes of the deposit:
    • id (integer) — deposit id,
    • user_id (integer) — id of the user the deposit belongs to,
    • coin (string),
    • txid (string) — hex-encoded txid in the Bitcoin network,
    • address (string) — the address the deposit has been sent,
    • amount (satoshis) — Bitcoin amount of the deposit,
    • created_at (date) — server time the deposit object was created,
    • status (string) — status of the deposit; can be one of: 'unconfirmed', 'confirmed', 'failed'
    • confirmations (integer) — amount of confirmations in the Bitcoin network, as seen by the server at the time of request; this field is NOT displayed when number of confirmations is greater than 10,
    • required_confirmations (integer) — amount of confirmations in the Bitcoin network that is required for this deposit to be credited to the account balance; this field is present only for unconfirmed transactions.
list_deposits({order: order, id_marker: id_marker, limit: limit})
Requires permissions: deposit or history
Parameters
  • order (string, optional) — specifies sorting of the results, accepted values 'asc' (ascending by id) or 'desc' (descending by id); default: 'desc'
  • id_marker (integer, optional) — if order is 'asc', only objects with id > id_marker are returned; if order is 'desc', only objests with id < id_marker are returned
  • limit (integer, optional) — limits number of objects returned; default: 100, max: 1000
Returns
  • an array of hashes, each hash contains attributes of a single deposit as returned by read_deposit.

Withdrawals

read_withdrawal({selector: {id: id}})
Requires permissions: withdraw or history
Parameters
  • id (integer) — an id of the withdrawal
Returns
  • a hash containing the attributes of the deposit:
    • id (integer) — deposit id,
    • user_id (integer) — id of the user the withdrawal belongs to,
    • coin (string),
    • withdrawal_type (string) — instant or batch,
    • txid (string) — hex-encoded txid in the Bitcoin network,
    • to_address (string) — the address the withdrawal has been sent to,
    • amount (satoshis) — Bitcoin amount of the deposit,
    • created_at (date) — server time the withdrawal object was created,
    • fee (satoshis) — withdrawal fee taken from the user balance,
    • status (string) — status of the deposit; can be one of: 'unconfirmed', 'confirmed', 'failed', 'pending' (waiting for hot wallet refill).
list_withdrawals({order: order, id_marker: id_marker, limit: limit})
Requires permissions: withdraw or history
Parameters
  • order (string, optional) — specifies sorting of the results, accepted values 'asc' (ascending by id) or 'desc' (descending by id); default: 'desc'
  • id_marker (integer, optional) — if order is 'asc', only objects with id > id_marker are returned; if order is 'desc', only objests with id < id_marker are returned
  • limit (integer, optional) — limits number of objects returned; default: 100, max: 1000
Returns
  • an array of hashes, each hash contains attributes of a single withdrawal as returned by read_withdrawal.
create_withdrawal({attrs: attrs})
Requires permissions: withdraw
Parameters
  • attrs (hash) — hash containing attributes of a withdrawal:
    • coin (string),
    • to_address (string) — the address to send the coins to,
    • amount (satoshis) — Bitcoin amount of the deposit,
    • withdrawal_type (string) — 'instant' (withdrawal is instantly submitted to the Bitcoin network) or 'batch' (cheaper, but can take up to 5 hours to get submitted to the network),
    • allow_pending (boolean) — in case there are not enough funds in hot waller, setting this to true will create a pending transaction, awaiting hot wallet refill.
Returns

Method returns a hash containing attributes of the created withdrawal. The output is identical to read_withdrawal method.

patch_withdrawal({selector: {id: id}, attrs: attrs})
Requires permissions: withdraw
Parameters
  • id (integer) — an id of the withdrawal
  • attrs (hash) — attributes to be updated; supported attributes are:
    • status (string) — only 'canceled' value is supported and only if current status is 'pending'
Returns

Method returns a hash containing attributes of the updated withdrawal. The output is identical to read_withdrawal method.

This method can be used only to cancel pending payments.

Investments

read_investment({selector: {id: id}})
Requires permissions: invest or history
Parameters
  • id (integer) — an id of the investment
Returns
  • a hash containing the attributes of the investment:
    • id (integer) — investment id,
    • coin (string),
    • status (string) — 'open' for active investments or 'closed' for closed investments,
    • base (satoshis) — initial value of the investment,
    • amount (satoshis) — current value of the investment; if investment is closed, this is the final value of the investment,
    • leverage (integer) — leverage of the investment, from 1 to 10,
    • loan_amount (satoshis) — the amount that has been added to this investment because of leverage used,
    • share (float) — share in site profit, 0 means 0%, 1 means 100%; this field is null for closed investments,
    • profit (satoshis) — profit of the investment; for closed investments this field represents the final profit,
    • created_at (date) — server time the investment was created,
    • closed_at (date) — server time the investment was closed (only for closed investments).

This method can only be used to get data about investments belonging to the authenticated user.

list_investments({status: status})
Requires permissions: invest or history
Parameters
  • status (string, optional) — if set to 'open', it lists only active investments; otherwise all investments created by the user are returned.
Returns
  • an array of hashes, each hash contains attributes of a single investment as returned by read_investment.
create_investment({attrs: attrs})
Requires permissions: invest
Parameters
  • attrs (hash) — hash containing attributes of a investment:
    • coin (string),
    • base (satoshis) — initial value of the investment,
    • leverage (integer) — leverage of the investment, from 1 to 10,
Returns

Method returns a hash containing attributes of the created investment. The output is identical to read_investment method.

patch_investment({selector: {id: id}, attrs: attrs})
Requires permissions: withdraw
Parameters
  • id (integer) — an id of the withdrawal
  • attrs (hash) — attributes to be updated; supported attributes are:
    • status (string) — only 'closed' value is supported and only if current status is 'pending'
Returns

Method returns a hash containing attributes of the updated investment. The output is identical to read_investment method.

This method can be now used to close open investments.

Misc

ping()
Returns
  • 'pong' (string)
You call this method to keep the connection alive. Note that some servers or clients will close an inactive connection, therefore it is recommended to send periodic ping() requests.