How I built an Interactive 30-Day Bitcoin Price Graph with React and an API
5 stars based on
Using non-TLS requests can leak your authentication credentials. Make sure that your client validates the server's SSL certificate. Failing to verify the server certificate makes your application vulnerable to man-in-the-middle attack. Timestamps are always represented as an integer number of milliseconds since the UTC Epoch a Unix timestamp. Prices and volumes are always represented as a decimal strings e. We use strings instead of floats to preserve the precision.
All other API calls are rate limited to 1 call per second. API call rate limits allow bursts of up to five consecutive calls. Exceeding the limit causes HTTP error code to be returned. The Bitcoin price chart blockchain api library is the recommended way to access the API: The following libraries were implemented by third parties or are no longer under active development and are listed here for convenience. No support bitcoin price chart blockchain api them is provided bitcoin price chart blockchain api Luno and they may be out of date.
A thorough review of the code is bitcoin price chart blockchain api before including them in any project. Returns a list of bids and asks in the order book. Ask orders are sorted by price ascending. Bid orders are sorted by price descending. Note that multiple orders at the same price are not necessarily conflated. Some API calls require your application to authenticate itself. This is done using bitcoin price chart blockchain api API key associated with your account.
An API key consists of an id and a secret. API requests are authenticated using HTTP basic authentication with the key id as bitcoin price chart blockchain api username and the key secret as the password. A missing, incorrect or revoked key causes error bitcoin price chart blockchain api be returned. Each API key is granted a set of permissions when it is created.
The key can only be used to call the permitted API functions. A set of permissions is represented as the bitwise OR of each permission in the set. All transactions on the Luno platform operate on accounts. Each account is denominated in a single currency and contains an ordered list of entries that track its running balance. Each account has a separate balance and available balance. The bitcoin price chart blockchain api balance may be lower than the balance if bitcoin price chart blockchain api funds have been reserved e.
Account entries affect the balance and available balance independently. Account entries are numbered sequentially. It is guaranteed that entries are never reordered or deleted. It is also guaranteed that the core attributes of the entry the running balances and index are never modified.
Therefore, an account acts as an append-only log of bitcoin price chart blockchain api. You must be verified to trade currency in order to be able to create an account. A user bitcoin price chart blockchain api a limit of 4 accounts per currency. Transaction entry rows are numbered sequentially starting from 1, where 1 is the oldest entry. At most rows can be requested per call.
Unlike account entries, pending transactions are not numbered, and may be reordered, deleted or updated at any time. Trading on the market is done by submitting trade orders. After a new order has been created, it is submitted for processing by the order matching engine. The order then either matches against an existing order in the order book and is filled or it rests in the order book until it is stopped.
Returns a list of the most recently placed orders. You can also specify the market by using the optional pair parameter. The list is truncated after items.
The base and counter amounts are the principal amounts that were traded, ignoring fees. Orders cannot be reversed once they have executed. Please ensure your program has been thoroughly tested before submitting orders.
A market order executes immediately, and either buys as much bitcoin that can be bought for a set amount of fiat bitcoin price chart blockchain api, or sells a set amount of bitcoin for as much fiat as possible.
Returns the default receive address associated with your account and the amount received via the address. You can specify an optional address parameter to return information for a non-default receive address.
Allocates a new receive address to your account. There is a rate limit of 1 address per hour, but bursts of up to 10 addresses are allowed. Only 1 Ethereum receive address can be created. Cancel a withdrawal request. Send Bitcoin from your account to a Bitcoin address or email address. Send Ethereum from your account to an Ethereum address. If the email address is not associated with an existing Luno account, an invitation to create an account and claim the funds will be sent.
Digital currency transactions are irreversible. Please ensure your program has been thoroughly tested before using this call. Quotes allow you to lock in an exchange rate for a short time with the option of either accepting or rejecting the quote.
Quotes can be useful for various customer-facing applications where price fluctuations would be confusing. The API is used as follows: First create a quote for the transaction that you want to perform. If you decide to accept the quote before it expires, you will exercise the quote. If you decide not to accept it, you will discard the bitcoin price chart blockchain api. You can also retrieve the status of a quote at any time.
You can specify either the exact amount that you want to pay or the exact amount that you want too receive. For example, to buy exactly 0. The returned quote includes the appropriate ZAR amount. The returned quote specifies the Bitcoin as the counter amount that will be returned.
An error is returned if your account is not verified for the currency pair, or if your account would have insufficient balance to ever exercise the quote. Exercise a quote to perform the trade. If there is sufficient balance available in your account, it will be debited and the counter amount credited. An error is returned if the quote has expired or if you have insufficient available balance. Once a quote has been discarded, it cannot be exercised even if it has not expired yet.
This API is still in beta phase. This means that it may still undergo incompatible changes. Bitcoin price chart blockchain api websocket API provides streaming access to market data. It is more efficient and provides lower latency information than repeatedly polling the orderbook and recent trades but is more complicated to implement. The streaming protocol works by requiring the client to keep an in-memory record of the order book. Update messages are then sent from the server and the client uses these to update its copy of the order book.
If they are applied correctly and fully, the client's view of the order book will be identical to the server's view. The client state consists of the following data: Each update message transmitted from the server has a unique increasing sequence number. The message with sequence number n can be applied to state sequence n-1 to produce state sequence n. In this case, an update message would be sent containing multiple trade updates.
There will be no create update since the new order never enters the order book. In this case, the update message contains multiple trade updates and a create update. The volume in the create update is the remaining volume for the order. The streaming updates protocol described above can be accessed using websockets. The server first sends the current order book state and thereafter sends update messages as quickly as possible.
Both the client and server must send regular keep alive messages to avoid disconnection during periods of low update message activity. If there is any error while processing an update e. It is critical that clients implement exponential backoff for all reconnections to avoid overloading the server in case of errors.