Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code:   DatasetGenerationCastError
Exception:    DatasetGenerationCastError
Message:      An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 2 new columns ({'gain_required_pct_to_recover', 'drawdown_pct'}) and 6 missing columns ({'contract_size', 'quote_currency', 'pip_size', 'symbol', 'asset_class', 'unit_step'}).

This happened while the csv dataset builder was generating data using

hf://datasets/eugene9099/position-sizing-data/drawdown-recovery.csv (at revision 203bb2d8f3bb42d83e7b7188c8959f00e3227a87), ['hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/contract-specifications.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/drawdown-recovery.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/losing-streak-equity.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/pip-value-by-lot-size.csv']

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1848, in _prepare_split_single
                  writer.write_table(table)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 765, in write_table
                  self._write_table(pa_table, writer_batch_size=writer_batch_size)
                  ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 773, in _write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2306, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              drawdown_pct: string
              gain_required_pct_to_recover: string
              -- schema metadata --
              pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 558
              to
              {'symbol': Value('string'), 'asset_class': Value('string'), 'quote_currency': Value('string'), 'pip_size': Value('float64'), 'contract_size': Value('int64'), 'unit_step': Value('float64')}
              because column names don't match
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1850, in _prepare_split_single
                  raise DatasetGenerationCastError.from_cast_error(
                  ...<4 lines>...
                  )
              datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
              
              All the data files must have the same columns, but at some point there are 2 new columns ({'gain_required_pct_to_recover', 'drawdown_pct'}) and 6 missing columns ({'contract_size', 'quote_currency', 'pip_size', 'symbol', 'asset_class', 'unit_step'}).
              
              This happened while the csv dataset builder was generating data using
              
              hf://datasets/eugene9099/position-sizing-data/drawdown-recovery.csv (at revision 203bb2d8f3bb42d83e7b7188c8959f00e3227a87), ['hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/contract-specifications.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/drawdown-recovery.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/losing-streak-equity.csv', 'hf://datasets/eugene9099/position-sizing-data@203bb2d8f3bb42d83e7b7188c8959f00e3227a87/pip-value-by-lot-size.csv']
              
              Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

symbol
string
asset_class
string
quote_currency
string
pip_size
float64
contract_size
int64
unit_step
float64
AUD/USD
forex
USD
0.0001
100,000
1,000
EUR/USD
forex
USD
0.0001
100,000
1,000
GBP/USD
forex
USD
0.0001
100,000
1,000
NZD/USD
forex
USD
0.0001
100,000
1,000
USD/JPY
forex
JPY
0.01
100,000
1,000
USD/CHF
forex
CHF
0.0001
100,000
1,000
USD/CAD
forex
CAD
0.0001
100,000
1,000
USD/MXN
forex
MXN
0.0001
100,000
1,000
USD/ZAR
forex
ZAR
0.0001
100,000
1,000
USD/TRY
forex
TRY
0.0001
100,000
1,000
USD/SEK
forex
SEK
0.0001
100,000
1,000
USD/NOK
forex
NOK
0.0001
100,000
1,000
USD/DKK
forex
DKK
0.0001
100,000
1,000
USD/PLN
forex
PLN
0.0001
100,000
1,000
USD/HUF
forex
HUF
0.0001
100,000
1,000
USD/CZK
forex
CZK
0.0001
100,000
1,000
USD/SGD
forex
SGD
0.0001
100,000
1,000
USD/HKD
forex
HKD
0.0001
100,000
1,000
USD/CNH
forex
CNH
0.0001
100,000
1,000
USD/THB
forex
THB
0.0001
100,000
1,000
USD/MYR
forex
MYR
0.0001
100,000
1,000
USD/PHP
forex
PHP
0.0001
100,000
1,000
USD/IDR
forex
IDR
0.0001
100,000
1,000
USD/INR
forex
INR
0.0001
100,000
1,000
USD/KRW
forex
KRW
0.0001
100,000
1,000
EUR/JPY
forex
JPY
0.01
100,000
1,000
GBP/JPY
forex
JPY
0.01
100,000
1,000
AUD/JPY
forex
JPY
0.01
100,000
1,000
CAD/JPY
forex
JPY
0.01
100,000
1,000
CHF/JPY
forex
JPY
0.01
100,000
1,000
NZD/JPY
forex
JPY
0.01
100,000
1,000
EUR/GBP
forex
GBP
0.0001
100,000
1,000
EUR/AUD
forex
AUD
0.0001
100,000
1,000
EUR/CAD
forex
CAD
0.0001
100,000
1,000
EUR/CHF
forex
CHF
0.0001
100,000
1,000
EUR/NZD
forex
NZD
0.0001
100,000
1,000
EUR/SEK
forex
SEK
0.0001
100,000
1,000
EUR/NOK
forex
NOK
0.0001
100,000
1,000
EUR/DKK
forex
DKK
0.0001
100,000
1,000
EUR/PLN
forex
PLN
0.0001
100,000
1,000
EUR/TRY
forex
TRY
0.0001
100,000
1,000
EUR/ZAR
forex
ZAR
0.0001
100,000
1,000
EUR/MXN
forex
MXN
0.0001
100,000
1,000
EUR/HUF
forex
HUF
0.0001
100,000
1,000
EUR/CZK
forex
CZK
0.0001
100,000
1,000
EUR/SGD
forex
SGD
0.0001
100,000
1,000
EUR/HKD
forex
HKD
0.0001
100,000
1,000
GBP/AUD
forex
AUD
0.0001
100,000
1,000
GBP/CAD
forex
CAD
0.0001
100,000
1,000
GBP/CHF
forex
CHF
0.0001
100,000
1,000
GBP/NZD
forex
NZD
0.0001
100,000
1,000
GBP/SEK
forex
SEK
0.0001
100,000
1,000
GBP/NOK
forex
NOK
0.0001
100,000
1,000
GBP/PLN
forex
PLN
0.0001
100,000
1,000
GBP/ZAR
forex
ZAR
0.0001
100,000
1,000
GBP/TRY
forex
TRY
0.0001
100,000
1,000
GBP/SGD
forex
SGD
0.0001
100,000
1,000
AUD/CAD
forex
CAD
0.0001
100,000
1,000
AUD/CHF
forex
CHF
0.0001
100,000
1,000
AUD/NZD
forex
NZD
0.0001
100,000
1,000
AUD/SGD
forex
SGD
0.0001
100,000
1,000
AUD/HKD
forex
HKD
0.0001
100,000
1,000
CAD/CHF
forex
CHF
0.0001
100,000
1,000
NZD/CAD
forex
CAD
0.0001
100,000
1,000
NZD/CHF
forex
CHF
0.0001
100,000
1,000
NZD/SGD
forex
SGD
0.0001
100,000
1,000
CHF/PLN
forex
PLN
0.0001
100,000
1,000
XAU/USD
metal
USD
0.01
100
1
XAG/USD
metal
USD
0.001
5,000
1
XPT/USD
metal
USD
0.01
100
1
XPD/USD
metal
USD
0.01
100
1
WTI/USD
energy
USD
0.01
1,000
1
BRENT/USD
energy
USD
0.01
1,000
1
NATGAS/USD
energy
USD
0.001
10,000
1
US30
index
USD
1
1
1
US500
index
USD
1
1
1
USTEC
index
USD
1
1
1
DE40
index
USD
1
1
1
UK100
index
USD
1
1
1
JP225
index
USD
1
1
1
AUS200
index
USD
1
1
1
FRA40
index
USD
1
1
1
EU50
index
USD
1
1
1
SPA35
index
USD
1
1
1
HK50
index
USD
1
1
1
CHINA50
index
USD
1
1
1
BTCUSDT
crypto
USD
0.01
1
0.001
ETHUSDT
crypto
USD
0.01
1
0.001
SOLUSDT
crypto
USD
0.01
1
0.001
XRPUSDT
crypto
USD
0.01
1
0.001
ADAUSDT
crypto
USD
0.01
1
0.001
DOGEUSDT
crypto
USD
0.01
1
0.001
AVAXUSDT
crypto
USD
0.01
1
0.001
LINKUSDT
crypto
USD
0.01
1
0.001
DOTUSDT
crypto
USD
0.01
1
0.001
TONUSDT
crypto
USD
0.01
1
0.001
LTCUSDT
crypto
USD
0.01
1
0.001
BCHUSDT
crypto
USD
0.01
1
0.001
UNIUSDT
crypto
USD
0.01
1
0.001
ATOMUSDT
crypto
USD
0.01
1
0.001
End of preview.

Position Sizing Reference Data

Interactive calculator: positionsizetool.com · Source and formulas: GitHub · Citable archive: doi:10.5281/zenodo.22840538 · Packages: PyPI · npm

Four small CSVs behind the question "how many units should I trade?", with the formulas that generate them. No dependencies, no API keys.

Formula

units = (risk_budget - commission) / ((|entry - stop| + spread) x quote_to_account_rate)

Tradable size is that result rounded down to the broker's unit step. Rounding up raises risk without saying so.

Files

File Rows Description
contract-specifications.csv 131 Contract size, pip size and unit step per instrument across forex, metals, energies, indices and crypto futures. Columns: symbol, asset_class, quote_currency, pip_size, contract_size, unit_step.
pip-value-by-lot-size.csv 4 Pip value per standard / mini / micro / nano lot on a USD-denominated account, plus the cost of a 20-pip move and of a 1-pip spread.
losing-streak-equity.csv 20 Equity remaining after 1 to 20 consecutive losses at 0.5%, 1% and 2% risk per trade. Generated by remaining = (1 - risk%)^n.
drawdown-recovery.csv 12 Gain required on the reduced balance to return to the original balance, for drawdowns from 5% to 90%. Generated by gain_required = 1 / (1 - drawdown) - 1.

Provenance

The instrument rows are the built-in defaults of an interactive calculator — typical retail contract specifications, not exchange-published official values. Verify contract size and unit step against your own broker before placing an order. Every other table is computed from the formula stated above, not copied. No price history, no tick data, no returns series.

Worked example

Account 10,000 USD, risk 1% (100 USD), EUR/USD at 1.1000, stop at 1.0980, no spread, no commission:

stop distance = |1.1000 - 1.0980| = 0.0020
units         = 100 / 0.0020     = 50,000
unit step     = 1,000  ->  tradable size = 50,000 (0.50 standard lot)

Cite

YI, JUN (2026). Position sizing reference data and worked arithmetic for forex, stocks and crypto futures [Data set]. Zenodo. https://doi.org/10.5281/zenodo.22840538

Licence

Data files: CC0 1.0 Universal. Code and documentation in the linked repository: MIT.

Not investment advice. Nothing here recommends a trade, a size or a broker.

Downloads last month
-