First Q/KDB+ Project

Joined
8/28/24
Messages
5
Points
3
Anyone willing to critique / give feedback on my first project written in q? Trying my best to plough through and learn it, steep learning curve and not a whole lot of resources out there. Sometimes I feel like I'm wasting my time and should transition to C++ but theres just something about q that pulls me in. Only about a month into studying it.

Any feedback would be much appreciated GitHub - TxmJxhn/Kelly-Criterion-Portfolio-Optimizer: A KDB+/q implementation of Kelly Criterion for portfolio optimization
 
hmm just personal opinion, I would suggest to name the local functions as global functions using :: or namespace System commands in q | Basics | kdb+ and q documentation - kdb+ and q documentation if you gonna use it with other scripts, otherwise for memory management, I would just rather name it as a list instead of local function or simplify it as below based on your code (excluding example usage). Feel free to ask if there are further questions :)

optimizePortfolio:{[r;p;rf]

n:k%sum abs k:((e*p)-1+p)%e: neg[rf] + sum r*p;
risk:sqrt sum (n*dev[r])xexp 2;
`weights`expectedReturn`risk!(n;e;risk)}
 
Back
Top Bottom