Ethereum: Historical Data Bitcoin in Json
On the present moment of the unintended interface API, which subdresses historical data on bitcoins, -the [blockchain.info] ( The volume is not less, this interface API uses only USD in the quality of the currency on the burning and does not represent the possibility of exploitable data, and the USD.
EXPERTY
Tents the publication of accessible in the current time of interfese API, it is necessary to develop a polish solving, which covers the treats. In this state, we dissatisfied with the possibility of API, based on JSON for historical bitcoins on Ethereum.
TRABING
For the grinding of the Interface Ethereum on the basis of API for historical data bitcoin should be dusted the following treats:
1
- Deneny Summer
: API should be subjected to many currencies, included Dollar, EUR, GBP and others.
- Historical Data Format : API should return historical shadows to bitcoins in the standard json format.
Enjoyment
To meet these treats, we can make a non -standard interface api with node.js and express.js, which are the popular structure of JavaScript for the creation of the internet. Here’s a predatory resolution on the highly ugly:
Shag 1: Remove the Model data
We strike a simple model data for the Historic Cartice for bitcoins on Ethereum. This is included in the dates of the timber, the Marqui Time, the open shadow, the close prices and the lapse.
`Javascript
const datamodel = {
ID: "Eth-Bitcoin-Historical-Data",
Tablitsa: ["Data", "Sercker Time", "Open_Price", "Close_price", "Tom"],
Diagram: {
"Data": {type: 'string'},
"Sercker Time": {Type: 'String'},
"Open_price": {type: 'Number'},
"Close_price": {type: 'Number'},
"Tom": {type: "integer"}
}
};
Shag 2: Create the API API API API
We consume quadrup points for historical data bitcoins:
Get /Historical Data ': Listen all historical scales.
- Get /Historical-Data /: Date
: Returns One Historical Point Data for the Dano Date.
3.
- Post /Historical-Data ‘: a new historical stretch of the shelter.
“ Javascript
Const Express = Termess (“Express”);
Const App = Express ();
App .use (Express.json ());
// Get /Historical-Data
App.get (‘/Historical-Data’, (req, res) => {
Const data = req.qury.date;
// Realizing logic for the restoration of all historical scores in the technical date
res.json (Datamodel);
});
// Get/Historical-Data/: Data
App.get (‘/Historical-Data/: Date’, (req, res) => {
Const data = req.params.date;
// Realize Logika for Lowering One Historical Note for Danna Date
const datapoin = datamodel.find ((d) => d.date === Date);
IF (! DATAPOINT) {
Res.status (404).
} in the anti -servant {
res.json (Datapoint);
}
});
// Get/Historical-Data/: Timestamp
App.get (‘/Historical-Data/: Timestamp’, (req, res) => {
Const Timestamp = req.params.timestamp;
// Realize logic for booting a single historical scan data for this Dano Marki Time
const datapoin = datamodel.find ((d) => d .timestamp === Timestamp);
IF (! DATAPOINT) {
Res.status (404).
} in the anti -servant {
res.json (Datapoint);
}
});
// Post /Data Historic
App .st (‘/Historical-Data’, (Req, Res) => {
Const data = req.body;
// Realize logic for consuming new historical data
Const Newatapoint = Datamodel.push ({{
Date: Data.date,
OPEN_PRICE: Data.open_price,
Close_price: Data.Close_Price,
Tom: Data.volume,
});
IF (! Newdodapoint) {
Res.status (404).