create account

Creating an API to List the Internal Marketplace by disregardfiat

View this thread on: hive.blogpeakd.comecency.com
· @disregardfiat · (edited)
$199.76
Creating an API to List the Internal Marketplace
We've got some really cool stuff going on with Hive. The new hardfork as well as the HBD stabilizer have really made our stable coin ~stable. The only thing that's missing is external tracking of our internal market.

To this end I followed [CoinGecko's API Guide for spot exchanges](https://docs.google.com/document/d/1v27QFoQq1SKT3Priq3aqPgB70Xd_PnDzbOCiuoCyixw/edit) and built this:
[hive_market_api](https://github.com/disregardfiat/hive_market_api)


Installation:
`$ git clone https://github.com/disregardfiat/hive_market_api.git`
`$ cd hive_market_api`
`$ npm i`
`$ node index.js` || `$ npm start`

It's meant to be run from a witness server WITH the market_history plugin. But you can just as easily point to one. I won't go into any details of routing this through a reverse proxy, but I will say the `CACHEMILSEC` is set to 60 secs because that's the query interval for coingecko. You can make a `.env` file to store your config variables.

```
exports.PORT = ENV.PORT || 3000;
exports.clientURL = ENV.CLIENTURL || "https://rpc.ecency.com/"  // 'http://127.0.0.1:8091/' //Run from same server.
exports.CACHEMILSEC = ENV.CACHEMILSEC || 60000 //1 minute
```

Here's the short list of API

`/api/orderbook/HIVE_HBD`
`/api/historical_trades/HIVE_HBD`
`/api/pairs`
`/api/tickers`
`/api/coin_detail`
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 285 others
👎  
properties (23)
authordisregardfiat
permlinkcreating-an-api-to-list-the-internal-marketplace
categoryhive-139531
json_metadata"{"app":"peakd/2021.07.2","format":"markdown","description":"Hive Market API for external trackers","tags":["hive","dev"],"users":[],"image":[]}"
created2021-07-17 22:21:03
last_update2021-07-18 20:31:30
depth0
children16
last_payout2021-07-24 22:21:03
cashout_time1969-12-31 23:59:59
total_payout_value99.906 HBD
curator_payout_value99.856 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,303
author_reputation316,321,895,198,604
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,981,305
net_rshares428,114,410,316,863
author_curate_reward""
vote details (350)
@burnoutawesome ·
Looks promising, following you up for the next updates!
properties (22)
authorburnoutawesome
permlinkre-disregardfiat-qwf5ex
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 02:25:45
last_update2021-07-18 02:25:45
depth1
children0
last_payout2021-07-25 02:25:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length55
author_reputation36,922,224,920,046
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,983,814
net_rshares0
@d-zero ·
Many thanks for this 😃
It's nice to see some big stake holders have voted for you. Sad your proposal for DHF didn't get this good reactions so fast.
!PIZZA
properties (22)
authord-zero
permlinkre-disregardfiat-2021723t20596823z
categoryhive-139531
json_metadata{"tags":["hive","dev"],"app":"ecency/3.0.18-vision","format":"markdown+html"}
created2021-07-23 15:29:09
last_update2021-07-23 15:29:09
depth1
children1
last_payout2021-07-30 15:29:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length155
author_reputation130,346,126,423,342
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id105,083,421
net_rshares0
@pizzabot ·
<div class='pull-right'><center><sup>Connect</sup></center><p><a href="https://discord.gg/Q9bQAKpWGS"><img src="https://files.peakd.com/file/peakd-hive/pizzabot/AKF96fKjnX3wjXERHcKAFHaoHnfTVhXqPjXVz8E1Th9nPiJqmFtaycosVpPBZ7z.png"></a></p></div><div class='pull-right'><center><sup>Trade</sup></center><p><a href='https://hive-engine.com/?p=market&t=PIZZA'><img src="https://files.peakd.com/file/peakd-hive/pizzabot/23sxbi2M4UjELDzQjxPdzubdgfMjHTCtA1xueyxmnhJUrB8136VyK3pqynyWYiZYF9HrC.png"></a></p></div><center><br> <p>@disregardfiat! I sent you a slice of <strong><em>$PIZZA</em></strong> on behalf of @d-zero.</p> <p>Learn more about <strong><em>$PIZZA Token</em></strong> at <a href="https://hive.pizza">hive.pizza</a> <sub>(5/10)</sub></p> </center><div></div>
properties (22)
authorpizzabot
permlinkre-re-disregardfiat-2021723t20596823z-20210723t153007z
categoryhive-139531
json_metadata"{"app": "beem/0.24.26"}"
created2021-07-23 15:30:09
last_update2021-07-23 15:30:09
depth2
children0
last_payout2021-07-30 15:30:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length765
author_reputation6,163,031,654,911
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id105,083,430
net_rshares0
@ecency ·
$0.04
Your content has been **voted** as a part of [Encouragement program](https://ecency.com/ecency/@good-karma/encouragement-program-continues-82eafcd10a299). Keep up the good work! <br><br>Use Ecency daily to boost your growth on platform! <br><br><b>Support Ecency</b><br>[Vote for Proposal](https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B141%5D&approve=true)<br>[Delegate HP and earn more](https://ecency.com/hive-125125/@ecency/daily-100-curation-rewards)
👍  
properties (23)
authorecency
permlinkre-2021717t23014699z
categoryhive-139531
json_metadata{"tags":["ecency"],"app":"ecency/3.0.16-welcome","format":"markdown+html"}
created2021-07-17 23:00:15
last_update2021-07-17 23:00:15
depth1
children0
last_payout2021-07-24 23:00:15
cashout_time1969-12-31 23:59:59
total_payout_value0.018 HBD
curator_payout_value0.017 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length474
author_reputation549,971,524,037,747
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,981,728
net_rshares77,216,168,438
author_curate_reward""
vote details (1)
@gtg ·
$0.03
Witness server shouldn't be running anything more than required for a block production. A public seed node, which witnesses are expected to run might be a good place for it, as the extra overhead is negligible for the state file and such seed nodes could serve also as basic API nodes (pretty much everything except for account history, that's the most resource hungry could be handled by such simple node)
👍  
properties (23)
authorgtg
permlinkqwj43h
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2021-07-20 05:47:48
last_update2021-07-20 05:47:48
depth1
children0
last_payout2021-07-27 05:47:48
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length406
author_reputation386,008,343,350,348
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id105,024,397
net_rshares63,258,396,725
author_curate_reward""
vote details (1)
@hivebuzz ·
$0.03
Congratulations @disregardfiat! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://images.hive.blog/60x60/http://hivebuzz.me/badges/toppayoutday.png"></td><td>Your post got the highest payout of the day</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@disregardfiat) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!
👍  
properties (23)
authorhivebuzz
permlinkhivebuzz-notify-disregardfiat-20210718t022356000z
categoryhive-139531
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2021-07-18 02:23:54
last_update2021-07-18 02:23:54
depth1
children0
last_payout2021-07-25 02:23:54
cashout_time1969-12-31 23:59:59
total_payout_value0.017 HBD
curator_payout_value0.017 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length638
author_reputation367,968,736,841,991
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,983,799
net_rshares75,672,553,630
author_curate_reward""
vote details (1)
@ocupation ·
Nice work m8!
properties (22)
authorocupation
permlinkqwfoyu
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2021-07-18 09:28:06
last_update2021-07-18 09:28:06
depth1
children0
last_payout2021-07-25 09:28:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation114,873,328,375,322
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,988,228
net_rshares0
@samstickkz ·
Nice one
properties (22)
authorsamstickkz
permlinkqwfgtx
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2021-07-18 06:32:21
last_update2021-07-18 06:32:21
depth1
children0
last_payout2021-07-25 06:32:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length8
author_reputation32,836,279,479,347
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,986,359
net_rshares0
@therealwolf ·
$0.03
re: creating-an-api-to-list-the-internal-marketplace
Good job. You might want to add `helmet`

```
import helmet from 'helmet'
api.use(helmet())
```
👍  
properties (23)
authortherealwolf
permlink1a949258-5e6f-4575-a1c6-7d6a46bbbda5
categoryhive-139531
json_metadata{"type":"doit/comment","origType":"doit/comment","tags":["42","hive-139531","beskar"],"format":"markdown","app":"doit/42","origApp":"doit/42","doit":{"url":"https://beskar.new/ref/1a949258-5e6f-4575-a1c6-7d6a46bbbda5","permlink":"1a949258-5e6f-4575-a1c6-7d6a46bbbda5","userId":"c30f7cd4-6ab6-4166-8ca5-109aea3d213c"}}
created2021-07-18 19:38:42
last_update2021-07-18 19:38:42
depth1
children1
last_payout2021-07-25 19:38:42
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length95
author_reputation558,480,608,877,321
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,996,213
net_rshares63,252,320,101
author_curate_reward""
vote details (1)
@disregardfiat ·
This is the kind of feedback we need! 
properties (22)
authordisregardfiat
permlinkre-therealwolf-qwgih5
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 20:05:33
last_update2021-07-18 20:05:33
depth2
children0
last_payout2021-07-25 20:05:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length38
author_reputation316,321,895,198,604
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,996,541
net_rshares0
@tobetada ·
good job!
properties (22)
authortobetada
permlinkre-disregardfiat-qwfoir
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 09:18:27
last_update2021-07-18 09:18:27
depth1
children0
last_payout2021-07-25 09:18:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9
author_reputation521,430,610,688,759
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,988,135
net_rshares0
@unorgmilitia ·
$0.03
I have no idea what this all means! But it sounds amazing!
👍  
properties (23)
authorunorgmilitia
permlinkre-disregardfiat-qwgly8
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 21:20:36
last_update2021-07-18 21:20:36
depth1
children3
last_payout2021-07-25 21:20:36
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length58
author_reputation20,023,830,661,286
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,997,552
net_rshares63,254,345,818
author_curate_reward""
vote details (1)
@disregardfiat ·
![Screenshot from 2021-07-18 18-51-07.png](https://files.peakd.com/file/peakd-hive/disregardfiat/23u6X11XJGrJj3TBbK5M5SxgiGVUNmdnzRY21qgKAzYhX3X8eBRSLfp3fRbLTRwUXeFLP.png)
This kind of quote are aggregated from exchanges like Bittrex... but a lot of volume happens on our internal market that isn't part of these quotes. This should help get better quotes for us.

properties (22)
authordisregardfiat
permlinkre-unorgmilitia-qwgngj
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 21:53:09
last_update2021-07-18 21:53:09
depth2
children2
last_payout2021-07-25 21:53:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length366
author_reputation316,321,895,198,604
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,998,166
net_rshares0
@unorgmilitia ·
awesome!!! 
properties (22)
authorunorgmilitia
permlinkre-disregardfiat-qwgnl1
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 21:55:48
last_update2021-07-18 21:55:48
depth3
children0
last_payout2021-07-25 21:55:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11
author_reputation20,023,830,661,286
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,998,202
net_rshares0
@unorgmilitia ·
idk why I wasn't following you before.. I am now. 
properties (22)
authorunorgmilitia
permlinkre-disregardfiat-qwgnlx
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 21:56:21
last_update2021-07-18 21:56:21
depth3
children0
last_payout2021-07-25 21:56:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length50
author_reputation20,023,830,661,286
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,998,207
net_rshares0
@urun ·
![untitled.gif](https://media.tenor.com/images/5198aac8f04c105379617199e0b9665b/tenor.gif)

Very good job!
properties (22)
authorurun
permlinkre-disregardfiat-qwf7n0
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2021.07.2"}
created2021-07-18 03:13:45
last_update2021-07-18 03:13:45
depth1
children0
last_payout2021-07-25 03:13:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length106
author_reputation93,309,389,073,611
root_title"Creating an API to List the Internal Marketplace"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id104,984,239
net_rshares0