historical candles using serum-api.bonfida.com

Following is not working:
curl “https://serum-api.bonfida.com/candles/BTCUSDC?resolution=3600

Got this from: Bonfida API

Is there an alternative to get historical candles using javascript?

Hey @Uma !

As mentioned in the docs this endpoint is deprecated.

We do not provide an alternative at the moment. You can build your own TV endpoint using the the Serum JS client and a database.

What’s the best way to get historical transactions using serum? Is there a way to get all transactions since genesis or get transactions for a fixed period of time using serum api or solana web3 ?

You can retrieve all the Solana transaction that interacted with Serum’s program ID but you won’t be able to deduce historical prices or trades from them.

  • For historical trades there is no better solution no monitor the event queue and store each Fill event in a DB. I recommend using accountSubscribe (pubsub) for this and not getAccountInfo JSON RPC API | Solana Docs

  • For historical prices you need to get the bbo, so there is no better solution than doing an accountSubscribe on the bids and asks accounts

What is the account Pubkey parameter that should be passed to accountSubscribe method for the bids and asks accounts?

Serum markets store bids and asks in two separate accounts. So you would need to deserialize the market account first (you will find the struct here) this will give you the asks and bids pubkeys.

what is the best place to clone the dex code and steps to build, I tried the instruction in: serum-dex/dex at master · project-serum/serum-dex · GitHub

I cannot locate do.sh for building the dex. I am able to run the solana-test-validator without problem.

should I be looking at a different place?

To build the program you can use:

cargo build-bpf

And to deploy

solana deploy <PROGRAM_FILEPATH>

Thank you. I just tried to buy on serum sol/usdt and get a message saying “Transaction failed”
failing on serum

I tried to use the crank facility to run according to instructions, get got the following error:
al@Queen:~/serum-dex/dex/crank$ cargo run – $CLUSTER whole-shebang $KEYPAIR $DEX_PROGRAM_ID
Compiling serum_dex v0.5.6 (/home/al/serum-dex/dex)
Compiling solana-client v1.10.3
error[E0599]: no variant or associated item named process_new_order_v3 found for enum state::State in the current scope
→ dex/src/state.rs:3265:23
1357 | pub enum State {}
| -------------- variant or associated item process_new_order_v3 not found here

3265 | Self::process_new_order_v3,
| ^^^^^^^^^^^^^^^^^^^^
| |
| variant or associated item not found in state::State
| help: there is an associated function with a similar name: process_cancel_order_v2

For more information about this error, try rustc --explain E0599.

I got instructions from: