BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Pintail · Measure turnover between two weight snapshots

Compare long-only portfolio snapshots under a one-way turnover budget.

Measure turnover between two weight snapshots

Netting buys against sells can hide turnover in an allocation comparison. Keep gross directional changes and the one-way budget explicit. Moving a quarter of the portfolio between two assets requires 0.25 one-way turnover. A 0.125 cap leaves 0.125 excess.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-pintail.git
cd blyx-pintail
blyxc native-run project.blyx -- "0.75,0.25" "0.5,0.5" 0.125

API and return values

Returns [largest drift index, absolute asset drift, one-way turnover, excess over the budget]. Inputs are aligned historical or hypothetical weights, including cash if applicable. Invalid input returns an empty vector.

ArgumentAccepted input
currentVector of: probability in [0,1]
targetVector of: probability in [0,1]
turnover_capprobability in [0,1]

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
0
0.25
0.25
0.125
Open in the full playground →

Practice

Change current = [1], target = [1], turnover_cap = 0.0. Predict the result, then run the program.

Hint

Returns [largest drift index, absolute asset drift, one-way turnover, excess over the budget]. Inputs are aligned historical or hypothetical weights, including cash if applicable.

Worked solution

The result vector is [0, 0, 0, 0]. Compare its fields with the return layout in the API section.

Find

    let current = [0.75, 0.25];

Replace with

    let current = [1];

Find

    let target = [0.5, 0.5];

Replace with

    let target = [1];

Find

    let turnover_cap = 0.125;

Replace with

    let turnover_cap = 0.0;

Output after the change

0
0
0
0