Skip to content

Commit

Permalink
upd for getOrderbook
Browse files Browse the repository at this point in the history
  • Loading branch information
avral committed Feb 10, 2023
1 parent 3994305 commit 604b194
Show file tree
Hide file tree
Showing 5 changed files with 525 additions and 10 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dev-server": "nodemon --exec babel-node TODO",
"start": "cross-env NODE_ENV=production node --nouse-idle-notification --expose-gc --max-old-space-size=8192 -r esm server/index.js",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore ."
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"analyze": "nuxt build --analyze"
},
"dependencies": {
"@azukisiromochi/vue-mo.js": "^1.0.2",
Expand Down Expand Up @@ -55,6 +56,7 @@
"nuxt-highcharts": "^2.0.3",
"nuxt-imagemin": "^1.0.0",
"ping.js": "^0.3.0",
"prompt-confirm": "^2.0.4",
"redis": "^4.0.0-rc.3",
"route-cache": "^0.4.5",
"skeleton-loader-vue": "^1.0.10",
Expand Down
8 changes: 7 additions & 1 deletion server/services/orderbookService/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,15 @@ async function getOrders({ chain, market_id, side }) {
})
}

export async function initialUpdate(chain) {
export async function initialUpdate(chain, market_id) {
await connectAll()

if (market_id) {
await updateOrders('buy', chain, market_id)
await updateOrders('sell', chain, market_id)
return
}

const markets = await Market.find({ chain })

for (const { chain, id: market } of markets) {
Expand Down
3 changes: 2 additions & 1 deletion server/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ async function main() {
}

if (command == 'load_orderbooks') {
const market_id = process.argv[4]
const network = config.networks[process.argv[3]]
if (!network) { console.log('No network provided!'); process.exit() }

await initialUpdate(network.name)
await initialUpdate(network.name, market_id)
}

process.exit()
Expand Down
2 changes: 1 addition & 1 deletion utils/eosjs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const MAX_PAGINATION_FETCHES = 5

import { JsonRpc as JsonRpcMultiEnds } from '../assets/libs/eosjs-jsonrpc'
import { shuffleArray } from './index'
import { JsonRpc as JsonRpcMultiEnds } from '~/assets/libs/eosjs-jsonrpc'


export function getMultyEndRpc(nodes) {
Expand Down
Loading

0 comments on commit 604b194

Please sign in to comment.