0
$\begingroup$

I am creating a backtest using vectorbt library. This is my function for all the portfolio metrics:

pf = vbt.Portfolio.from_signals(
    signal_data['close'],
    entries,
    exits,
    init_cash=10_000_000,
    freq='D'
)

Now, instead of using the close price I want to switch to bid and ask prices for my trades.

Is there a convenient way to do this?

$\endgroup$
1
  • $\begingroup$ you prob want to make a github issue for the library you are using $\endgroup$
    – pyCthon
    Jul 26, 2023 at 2:29

1 Answer 1

0
$\begingroup$

There doesn't seem to be a convenient way to get this data, but it should be theoretically possible if you're using vectorbtpro (https://vectorbt.pro/), which allows you to pull data form Nasdaq Data Link (https://data.nasdaq.com/). It looks like Nasdaq provides historic order book data through Nasdaq Data-on-Demand (https://www.nasdaq.com/solutions/nasdaq-data-on-demand).

I doubt this is convenient, since there's no documentation on vectorbtpro's site about how to do this. Expect to need to write your own Python extensions to expose the relevant bid/ask data in a convenient data structure. Also, depending on your budget, paying for the relevant data from Nasdaq may be cost prohibitive. (They don't list the price on their site if you don't already have an account, and I'm inclined to think the price is quite high: https://data.nasdaq.com/databases/NDOD/pricing/plans)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.