Comments (1)
Hello! valid point. The definition of volume in value units I'm using seems a bit arbitrary. The correct one would use the volume-weighted average price (VWAP): the sum, over the period, of each trade in number of shares times its transaction price, divided by the sum over the period of the number of shares traded. Then, ValueVolume = Volume * VWAP
. Of course that can't be computed unless one has access to tick data, which is way beyond the level of complexity I'm targeting here. Any other definition like mine or yours is an approximation of the correct one (see, e.g., https://stanford.edu/~boyd/papers/pdf/vwap_opt_exec.pdf ).
I guess my definition has the merit of simplicity since it only uses one element of the open-high-low-close dataframe. (You could as well argue that (Open + Close + High + Low)/4
is a better one.) Also, since in the book we focus on open prices only (in fact, abstracting away the concept of close, high, and low prices) this seems more consistent. In many settings (like continuous markets, take BTC-USD
on 1-minute periods) you wouldn't care about close prices in fact, and only need to keep track of one price array and one volume array, both sampled at the start of each period.
However, I promise that by the time we release a stable version, decisions such as this one will be easy to override by defining a different data accessor, without having to patch the source code itself.
from cvxportfolio.
Related Issues (20)
- Interest rate on short sell cash proceeds
- Error from sp500_ndx100 example HOT 1
- Issue When Running examples/sp500_ndx100.py HOT 5
- I HOT 2
- NaN Handling HOT 3
- MultiPeriodOptimization Behavior Documentation HOT 10
- Single-step use question HOT 5
- do_asset_selection potential bug HOT 3
- Pandas 2.2.0 causes issues HOT 1
- Possible issue when using Cvxportfolio's internet access through a VPN HOT 4
- Make test suite fail on warnings
- Questions on accounting model (e.g., for short positions) HOT 3
- Robustify online execution of example strategies (when open prices are missing) HOT 1
- Failure on non-numeric (object dtpye) user-provided data difficult to understand HOT 6
- Example request - Margin in a different currency HOT 14
- BUG: packaging failed to include modules moved into submodules (constraints, data)
- Feature request: handle user-defined time-varying universes (and better error checks with temporary `nan`s in user-provided returns) HOT 13
- Data quality issues in `ftse100_daily` example strategy
- EOFError: Ran out of input HOT 4
- Rendering of code blocks in README on github is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cvxportfolio.