WU Trading Library 0.2.0
A backtesting and trading strategy library
Loading...
Searching...
No Matches
positions.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "types.h"

Go to the source code of this file.

Data Structures

struct  WU_Position
 WU_Position represents an open position in the portfolio. More...
struct  WU_PositionVector
 WU_PositionVector is a data structure that holds multiple positions for a single asset. More...
struct  WU_PositionSizingParams
 Position sizing policy. More...

Macros

#define WU_SYMBOL_MAX_LEN   32
#define wu_position_add(vec, pos)
#define wu_position_remove(vec, index)
#define wu_position_clear(vec)
#define wu_position_get(vec, index, found)
#define wu_position_total_quantity(vec)
#define wu_position_vector_delete(vec)

Enumerations

enum  WU_PositionSizeType { WU_POSITION_SIZE_ABS = 0 , WU_POSITION_SIZE_PCT = 1 , WU_POSITION_SIZE_PCT_EQUAL = 2 , WU_POSITION_SIZE_STRATEGY_GUIDED = 3 }
 WU_PositionSizeType represents the type of position sizing used in the portfolio. More...

Functions

WU_PositionVectorwu_position_vector_new (const char *symbol)

Macro Definition Documentation

◆ wu_position_add

#define wu_position_add ( vec,
pos )
Value:
((vec)->add((vec), (pos)))

Definition at line 40 of file positions.h.

◆ wu_position_clear

#define wu_position_clear ( vec)
Value:
((vec)->clear((vec)))

Definition at line 42 of file positions.h.

◆ wu_position_get

#define wu_position_get ( vec,
index,
found )
Value:
((vec)->get((vec), (index), (found)))

Definition at line 43 of file positions.h.

◆ wu_position_remove

#define wu_position_remove ( vec,
index )
Value:
((vec)->remove((vec), (index)))

Definition at line 41 of file positions.h.

◆ wu_position_total_quantity

#define wu_position_total_quantity ( vec)
Value:
((vec)->total_quantity((vec)))

Definition at line 44 of file positions.h.

◆ wu_position_vector_delete

#define wu_position_vector_delete ( vec)
Value:
do { \
if ((vec)->delete) \
(vec)->delete((WU_PositionVector*)(vec)); \
} while(0)
WU_PositionVector is a data structure that holds multiple positions for a single asset.
Definition positions.h:24

Definition at line 45 of file positions.h.

◆ WU_SYMBOL_MAX_LEN

#define WU_SYMBOL_MAX_LEN   32

Definition at line 8 of file positions.h.

Enumeration Type Documentation

◆ WU_PositionSizeType

WU_PositionSizeType represents the type of position sizing used in the portfolio.

It can be an absolute quantity, a percentage of the portfolio value, an equal percentage across all assets, or a strategy-guided position sizing where the strategy determines the size of the position based on its own logic.

Enumerator
WU_POSITION_SIZE_ABS 
WU_POSITION_SIZE_PCT 
WU_POSITION_SIZE_PCT_EQUAL 
WU_POSITION_SIZE_STRATEGY_GUIDED 

Definition at line 59 of file positions.h.

Function Documentation

◆ wu_position_vector_new()

WU_PositionVector * wu_position_vector_new ( const char * symbol)

Definition at line 70 of file positionvector.c.