We now have API calls for the investing functionality:Retrieve your investor stats:
You can retrieve your investor statistics with the following API call:
https://session.satoshidice.com/investor/invest.php?secret=YourSecretAsItAppearsInURL Typical response:
({
"percentage": "0.000000000",
"initial_investment": "0.00000000",
"current_investment": "0.00000000",
"current_profit": "0.00000000",
"gross_profit": "0.00000000",
"last_high_profit": "0.00000000",
"total_comission_paid": "0.00000000",
"InvestorBalance": "277.37303014",
"total_house_profit": "227.58197066",
"protected": "1",
"status": "success"
})
Or if the provided secret is invalid, the page simply outputs:
({
"message": "Wrong Secret",
"status": "fail"
})
Make an investment:
You can make an investment with the following API call:
https://session.satoshidice.com/investor/investing.php?secret=YourSecretAsItAppearsInURL&amount=amountInBTC The minimum amount to invest is 0.001BTC
If the provided secret is invalid, the page simply outputs:
({
"message": "Wrong Secret",
"status": "fail"
})
Or if the amount provided is invalid:
({
"message": "You have to invest at least 0.001 BTC.",
"status": "fail"
})
If there is no Balance available for investing in your account:
({
"message": "Not enough balance",
"status": "fail"
})
On General Error it will output:
({
"message": "General Error occured.",
"status": "fail"
})
A successfull investment will output:
({
"message": "Successfully invested amountInBTC .",
"status": "success"
})
Make an Divestment:
You can make an divestment with the following API call:
https://session.satoshidice.com/investor/divesting.php?secret=YourSecretAsItAppearsInURL&amount=amountInBTC&p=yourpassword The "p" parameter is only needed if your account is password protected.
If the provided secret is invalid, the page simply outputs:
({
"message": "Wrong Secret",
"status": "fail"
})
Or if the amount provided is invalid:
({
"message": "Invalid Amount",
"status": "fail"
})
If there is no Balance available for divesting:
({
"message": "Not enough balance",
"status": "fail"
})
If the password is wrong:
({
"message": "Incorrect Password",
"status": "10"
})
A successfull divestment will output:
({
"message": "Successfully divested amountInBTC .",
"status": "success"
})
On General Error it will output:
({
"message": "General Error occured.",
"status": "fail"
})
Password protection:
SatoshiDice offers password protection for your account.This means that on a password protected account ,a password will be needed for divestments and withdrawals.
A typical API call for setting up a password is :
https://session.satoshidice.com/userapi/protect.php?secret=YourSecretAsItAppearsInURL&p=yourpasswordPassword must contains only A-Za-z0-9 characters and must not be longer than 32 characters.
On success it will print:
({
"message": "Successfully added.",
"status": "success"
})
You can change your password bu using this API call:
https://session.satoshidice.com/userapi/protect.php?secret=YourSecretAsItAppearsInURL&p=newpassword&oldp=oldpasswordOn success it will print:
({
"message": "Successfully added.",
"status": "success"
})
There can be the following errrors returned ,which are self explanatory:
({
"message": "Password must contains only A-Za-z0-9",
"status": "fail"
})
({
"message": "Password cannot be empty",
"status": "fail"
})
({
"message": "Password cannot be longer than 32 chars.",
"status": "fail"
})
({
"message": "Old Password is wrong.",
"status": "fail"
})
And finally a general error:
({
"message": "Error occured",
"status": "fail"
})