# Market data sources (/features/data/market-data-sources)

## FinDataPy \[#findatapy]

New in v2024.8.20

✅ Introducing a new class for [findatapy](https://github.com/cuemacro/findatapy), designed to
pull data from Bloomberg, Eikon, Quandl, Dukascopy, and other data sources.

```python title="Discover tickers on Dukascopy and pull one day of tick data"
>>> vbt.FinPyData.list_symbols(data_source="dukascopy")
['fx.dukascopy.tick.NYC.AUDCAD',
 'fx.dukascopy.tick.NYC.AUDCHF',
 'fx.dukascopy.tick.NYC.AUDJPY',
 ...
 'fx.dukascopy.tick.NYC.USDTRY',
 'fx.dukascopy.tick.NYC.USDZAR',
 'fx.dukascopy.tick.NYC.ZARJPY']

>>> data = vbt.FinPyData.pull(  # (1)
...     "fx.dukascopy.tick.NYC.EURUSD",
...     start="14 Jun 2016",
...     end="15 Jun 2016"
... )
>>> data.get()
                                     close
Date
2016-06-14 00:00:00.844000+00:00  1.128795
2016-06-14 00:00:01.591000+00:00  1.128790
2016-06-14 00:00:01.743000+00:00  1.128775
2016-06-14 00:00:02.464000+00:00  1.128770
2016-06-14 00:00:02.971000+00:00  1.128760
...                                    ...
2016-06-14 23:59:57.733000+00:00  1.121020
2016-06-14 23:59:58.239000+00:00  1.121030
2016-06-14 23:59:58.953000+00:00  1.121035
2016-06-14 23:59:59.004000+00:00  1.121050
2016-06-14 23:59:59.934000+00:00  1.121055

[82484 rows x 1 columns]

>>> data = vbt.FinPyData.pull(  # (2)
...     "EURUSD",
...     start="14 Jun 2016",
...     end="15 Jun 2016",
...     timeframe="tick",
...     category="fx",
...     data_source="dukascopy",
...     fields=["bid", "ask", "bidv", "askv"]
... )
>>> data.get()
                                      bid      ask  bidv   askv
Date
2016-06-14 00:00:00.844000+00:00  1.12877  1.12882  1.00  10.12
2016-06-14 00:00:01.591000+00:00  1.12877  1.12881  1.00   1.00
2016-06-14 00:00:01.743000+00:00  1.12875  1.12880  3.11   3.00
2016-06-14 00:00:02.464000+00:00  1.12875  1.12879  2.21   1.00
2016-06-14 00:00:02.971000+00:00  1.12875  1.12877  2.21   1.00
...                                   ...      ...   ...    ...
2016-06-14 23:59:57.733000+00:00  1.12100  1.12104  1.24   1.50
2016-06-14 23:59:58.239000+00:00  1.12101  1.12105  9.82   1.12
2016-06-14 23:59:58.953000+00:00  1.12102  1.12105  1.50   1.12
2016-06-14 23:59:59.004000+00:00  1.12103  1.12107  1.50   1.12
2016-06-14 23:59:59.934000+00:00  1.12103  1.12108  1.87   2.25

[82484 rows x 4 columns]
```

1.  String format.
2.  Keyword format.

## Databento \[#databento]

New in v2023.12.23

✅ Introducing a new class specialized in pulling data from [Databento](https://databento.com/).

```python title="Get best bid and offer (BBO) data from Databento"
>>> vbt.BentoData.set_custom_settings(
...     client_config=dict(
...         key="YOUR_KEY"
...     )
... )
>>> params = dict(
...     symbols="ESH3",
...     dataset="GLBX.MDP3",
...     start=vbt.timestamp("2022-10-28 20:30:00"),
...     end=vbt.timestamp("2022-10-28 21:00:00"),
...     schema="tbbo"
... )
>>> vbt.BentoData.get_cost(**params)
1.2002885341644287e-05

>>> data = vbt.BentoData.pull(**params)
>>> data.get()
                                                               ts_event  \
ts_recv
2022-10-28 20:30:59.047138053+00:00 2022-10-28 20:30:59.046914657+00:00
2022-10-28 20:37:53.112494436+00:00 2022-10-28 20:37:53.112246421+00:00
...
2022-10-28 20:59:15.075191111+00:00 2022-10-28 20:59:15.074953895+00:00
2022-10-28 20:59:34.607239899+00:00 2022-10-28 20:59:34.606984277+00:00

                                     rtype  publisher_id  instrument_id  \
ts_recv
2022-10-28 20:30:59.047138053+00:00      1             1         206299
2022-10-28 20:37:53.112494436+00:00      1             1         206299
...
2022-10-28 20:59:15.075191111+00:00      1             1         206299
2022-10-28 20:59:34.607239899+00:00      1             1         206299

                                    action side  depth    price  size  flags  \
ts_recv
2022-10-28 20:30:59.047138053+00:00      T    B      0  3955.25     1      0
2022-10-28 20:37:53.112494436+00:00      T    A      0  3955.00     1      0
...
2022-10-28 20:59:15.075191111+00:00      T    A      0  3953.75     1      0
2022-10-28 20:59:34.607239899+00:00      T    A      0  3954.50     2      0

                                     ts_in_delta  sequence  bid_px_00  \
ts_recv
2022-10-28 20:30:59.047138053+00:00        18553  73918214    3954.75
2022-10-28 20:37:53.112494436+00:00        18334  73926240    3955.00
...
2022-10-28 20:59:15.075191111+00:00        19294  73945515    3953.75
2022-10-28 20:59:34.607239899+00:00        18701  73945932    3954.50

                                     ask_px_00  bid_sz_00  ask_sz_00  \
ts_recv
2022-10-28 20:30:59.047138053+00:00    3955.25          1          1
2022-10-28 20:37:53.112494436+00:00    3955.75          1          1
...
2022-10-28 20:59:15.075191111+00:00    3956.00          1          1
2022-10-28 20:59:34.607239899+00:00    3956.00          4          1

                                     bid_ct_00  ask_ct_00 symbol
ts_recv
2022-10-28 20:30:59.047138053+00:00          1          1   ESH3
2022-10-28 20:37:53.112494436+00:00          1          1   ESH3
...
2022-10-28 20:59:15.075191111+00:00          1          1   ESH3
2022-10-28 20:59:34.607239899+00:00          3          1   ESH3
```

## Trading View \[#trading-view]

New in 1.9.0

✅ A new class specialized for pulling data from [TradingView](https://www.tradingview.com/) is
now available.

```python title="Pull 1-minute AAPL data"
>>> data = vbt.TVData.pull(
...     "NASDAQ:AAPL",
...     timeframe="1 minute",
...     tz="US/Eastern"
... )
>>> data.get()
                             Open    High     Low   Close   Volume
datetime
2022-12-05 09:30:00-05:00  147.75  148.31  147.50  148.28  37769.0
2022-12-05 09:31:00-05:00  148.28  148.67  148.28  148.49  10525.0
2022-12-05 09:32:00-05:00  148.50  148.73  148.30  148.30   4860.0
2022-12-05 09:33:00-05:00  148.25  148.73  148.25  148.64   5306.0
2022-12-05 09:34:00-05:00  148.62  148.97  148.52  148.97   5808.0
...                           ...     ...     ...     ...      ...
2023-01-17 15:55:00-05:00  135.80  135.91  135.80  135.86  37573.0
2023-01-17 15:56:00-05:00  135.85  135.88  135.80  135.88  18796.0
2023-01-17 15:57:00-05:00  135.88  135.93  135.85  135.91  21019.0
2023-01-17 15:58:00-05:00  135.90  135.97  135.89  135.95  20934.0
2023-01-17 15:59:00-05:00  135.94  136.00  135.84  135.94  86696.0

[11310 rows x 5 columns]
```

## Symbol search \[#symbol-search]

New in 1.7.0

✅ Most data classes can retrieve the complete list of symbols available for an exchange, and
optionally filter the list using a [globbing](https://en.wikipedia.org/wiki/Glob_\(programming\)) or
[regular expression](https://en.wikipedia.org/wiki/Regular_expression) pattern. This also works for
local data classes.

```python title="Get all XRP pairs listed on Binance"
>>> vbt.BinanceData.list_symbols("XRP*")
{'XRPAUD',
 'XRPBEARBUSD',
 'XRPBEARUSDT',
 'XRPBIDR',
 'XRPBKRW',
 'XRPBNB',
 'XRPBRL',
 'XRPBTC',
 'XRPBULLBUSD',
 'XRPBULLUSDT',
 'XRPBUSD',
 'XRPDOWNUSDT',
 'XRPETH',
 'XRPEUR',
 'XRPGBP',
 'XRPNGN',
 'XRPPAX',
 'XRPRUB',
 'XRPTRY',
 'XRPTUSD',
 'XRPUPUSDT',
 'XRPUSDC',
 'XRPUSDT'}
```

## Symbol classes \[#symbol-classes]

New in 1.7.0

✅ Since VBT leverages multi-indexes in Pandas, you can associate each symbol with one or more
classes, such as sectors. This allows you to analyze the performance of a trading strategy relative
to each class.

```python title="Compare equal-weighted portfolios for three sectors"
>>> classes = vbt.symbol_dict({
...     "MSFT": dict(sector="Technology"),
...     "GOOGL": dict(sector="Technology"),
...     "META": dict(sector="Technology"),
...     "JPM": dict(sector="Finance"),
...     "BAC": dict(sector="Finance"),
...     "WFC": dict(sector="Finance"),
...     "AMZN": dict(sector="Retail"),
...     "WMT": dict(sector="Retail"),
...     "BABA": dict(sector="Retail"),
... })
>>> data = vbt.YFData.pull(
...     list(classes.keys()),
...     classes=classes,
...     missing_index="drop"
... )
>>> pf = vbt.PF.from_orders(
...     data,
...     size=vbt.index_dict({0: 1 / 3}),  # (1)
...     size_type="targetpercent",
...     group_by="sector",
...     cash_sharing=True
... )
>>> pf.value.vbt.plot().show()
```

1.  There are three assets in each group. Allocate 33.3% to each asset at the first bar.

Equal-weighted Technology, Finance, and Retail portfolio values over time. [Figure data (JSON)](/assets/figures/features/data/classes.dc2278f36b04.json)

## Polygon.io \[#polygonio]

New in 1.1.1

✅ Welcome a new class specialized in pulling data from [Polygon.io](https://polygon.io/)!

```python title="Get one month of 30-minute AAPL data from Polygon.io"
>>> vbt.PolygonData.set_custom_settings(
...     client_config=dict(
...         api_key="YOUR_API_KEY"
...     )
... )
>>> data = vbt.PolygonData.pull(
...     "AAPL",
...     start="2022-12-01",  # (1)
...     end="2023-01-01",
...     timeframe="30 minutes",
...     tz="US/Eastern"
... )
>>> data.get()
                             Open    High     Low     Close   Volume  \
Open time
2022-12-01 04:00:00-05:00  148.08  148.08  147.04  147.3700  50886.0
2022-12-01 04:30:00-05:00  147.37  147.37  147.12  147.2600  16575.0
2022-12-01 05:00:00-05:00  147.31  147.51  147.20  147.3800  20753.0
2022-12-01 05:30:00-05:00  147.43  147.56  147.38  147.3800   7388.0
2022-12-01 06:00:00-05:00  147.30  147.38  147.24  147.2400   7416.0
...                           ...     ...     ...       ...      ...
2022-12-30 17:30:00-05:00  129.94  130.05  129.91  129.9487  35694.0
2022-12-30 18:00:00-05:00  129.95  130.00  129.94  129.9500  15595.0
2022-12-30 18:30:00-05:00  129.94  130.05  129.94  130.0100  20287.0
2022-12-30 19:00:00-05:00  129.99  130.04  129.99  130.0000  12490.0
2022-12-30 19:30:00-05:00  130.00  130.04  129.97  129.9700  28271.0

                           Trade count      VWAP
Open time
2022-12-01 04:00:00-05:00         1024  147.2632
2022-12-01 04:30:00-05:00          412  147.2304
2022-12-01 05:00:00-05:00          306  147.3466
2022-12-01 05:30:00-05:00          201  147.4818
2022-12-01 06:00:00-05:00          221  147.2938
...                                ...       ...
2022-12-30 17:30:00-05:00          350  129.9672
2022-12-30 18:00:00-05:00          277  129.9572
2022-12-30 18:30:00-05:00          312  130.0034
2022-12-30 19:00:00-05:00          176  130.0140
2022-12-30 19:30:00-05:00          366  129.9941

[672 rows x 7 columns]
```

1.  In the timezone provided via `tz`.

## Alpha Vantage \[#alpha-vantage]

New in 1.1.1

✅ Welcome a new class specialized in pulling data from [Alpha Vantage](https://www.alphavantage.co/)!

```python title="Get Stochastic RSI of IBM from Alpha Vantage"
>>> data = vbt.AVData.pull(
...     "IBM",
...     category="technical-indicators",
...     function="STOCHRSI",
...     params=dict(fastkperiod=14)
... )
>>> data.get()
                              FastD     FastK
1999-12-07 00:00:00+00:00  100.0000  100.0000
1999-12-08 00:00:00+00:00  100.0000  100.0000
1999-12-09 00:00:00+00:00   77.0255   31.0765
1999-12-10 00:00:00+00:00   43.6922    0.0000
1999-12-13 00:00:00+00:00   12.0197    4.9826
...                             ...       ...
2023-01-26 00:00:00+00:00   11.7960    0.0000
2023-01-27 00:00:00+00:00    3.7773    0.0000
2023-01-30 00:00:00+00:00    4.4824   13.4471
2023-01-31 00:00:00+00:00    7.8258   10.0302
2023-02-01 16:00:01+00:00   13.0966   15.8126

[5826 rows x 2 columns]
```

## Nasdaq Data Link \[#nasdaq-data-link]

New in 1.1.1

✅ Welcome a new class specialized in pulling data from [Nasdaq Data Link](https://data.nasdaq.com/)!

```python title="Get Index of Consumer Sentiment from Nasdaq Data Link"
>>> data = vbt.NDLData.pull("UMICH/SOC1")
>>> data.get()
                           Index
Date
1952-11-30 00:00:00+00:00   86.2
1953-02-28 00:00:00+00:00   90.7
1953-08-31 00:00:00+00:00   80.8
1953-11-30 00:00:00+00:00   80.7
1954-02-28 00:00:00+00:00   82.0
...                          ...
2022-08-31 00:00:00+00:00   58.2
2022-09-30 00:00:00+00:00   58.6
2022-10-31 00:00:00+00:00   59.9
2022-11-30 00:00:00+00:00   56.8
2022-12-31 00:00:00+00:00   59.7

[632 rows x 1 columns]
```

## Alpaca \[#alpaca]

New in 1.0.2

✅ Welcome a new class specialized in pulling data from [Alpaca](https://alpaca.markets/)!

```python title="Get one week of adjusted 1-minute AAPL data from Alpaca"
>>> vbt.AlpacaData.set_custom_settings(
...     client_config=dict(
...         api_key="YOUR_API_KEY",
...         secret_key="YOUR_API_SECRET"
...     )
... )
>>> data = vbt.AlpacaData.pull(
...     "AAPL",
...     start="one week ago 00:00",  # (1)
...     end="15 minutes ago",  # (2)
...     timeframe="1 minute",
...     adjustment="all",
...     tz="US/Eastern"
... )
>>> data.get()
                               Open      High       Low     Close  Volume  \
Open time
2023-01-30 04:00:00-05:00  145.5400  145.5400  144.0100  144.0200  5452.0
2023-01-30 04:01:00-05:00  144.0800  144.0800  144.0000  144.0500  3616.0
2023-01-30 04:02:00-05:00  144.0300  144.0400  144.0100  144.0100  1671.0
2023-01-30 04:03:00-05:00  144.0100  144.0300  144.0000  144.0300  4721.0
2023-01-30 04:04:00-05:00  144.0200  144.0200  144.0200  144.0200  1343.0
...                             ...       ...       ...       ...     ...
2023-02-03 19:54:00-05:00  154.3301  154.3301  154.3301  154.3301   347.0
2023-02-03 19:55:00-05:00  154.3300  154.3400  154.3200  154.3400  1438.0
2023-02-03 19:56:00-05:00  154.3400  154.3400  154.3300  154.3300   588.0
2023-02-03 19:58:00-05:00  154.3500  154.3500  154.3500  154.3500   555.0
2023-02-03 19:59:00-05:00  154.3400  154.3900  154.3300  154.3900  3835.0

                           Trade count        VWAP
Open time
2023-01-30 04:00:00-05:00          165  144.376126
2023-01-30 04:01:00-05:00           81  144.036336
2023-01-30 04:02:00-05:00           52  144.035314
2023-01-30 04:03:00-05:00           56  144.012680
2023-01-30 04:04:00-05:00           40  144.021854
...                                ...         ...
2023-02-03 19:54:00-05:00           21  154.331340
2023-02-03 19:55:00-05:00           38  154.331756
2023-02-03 19:56:00-05:00           17  154.338971
2023-02-03 19:58:00-05:00           27  154.343090
2023-02-03 19:59:00-05:00           58  154.357219

[4224 rows x 7 columns]
```

1.  In the timezone provided via `tz`.
2.  Remove if you have a paid plan.
