#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "wu.h"
Go to the source code of this file.
|
| static char * | wu_strdup (const char *s) |
| static void | stats_update (struct WU_PortfolioStats_ *stats, double cash, double portfolio_value, WU_TimeStamp timestamp) |
| static void | stats_record_trade (struct WU_PortfolioStats_ *stats, double pnl, WU_CloseReason reason) |
| static void | stats_update_position (struct WU_PortfolioStats_ *stats, int asset_index, const char *symbol, double quantity, double value, double last_price) |
| static char * | stats_to_keyvalue (struct WU_PortfolioStats_ *stats) |
| static char * | stats_to_json (struct WU_PortfolioStats_ *stats, bool pretty) |
| static void | stats_reset (struct WU_PortfolioStats_ *stats) |
| static void | stats_free (struct WU_PortfolioStats_ *stats) |
| WU_PortfolioStats | wu_portfolio_stats_new (double initial_cash, double risk_free_rate) |
| | Creates a new WU_PortfolioStats instance.
|
◆ stats_free()
◆ stats_record_trade()
◆ stats_reset()
◆ stats_to_json()
◆ stats_to_keyvalue()
◆ stats_update()
◆ stats_update_position()
| void stats_update_position |
( |
struct WU_PortfolioStats_ * | stats, |
|
|
int | asset_index, |
|
|
const char * | symbol, |
|
|
double | quantity, |
|
|
double | value, |
|
|
double | last_price ) |
|
static |
◆ wu_portfolio_stats_new()
| WU_PortfolioStats wu_portfolio_stats_new |
( |
double | initial_cash, |
|
|
double | risk_free_rate ) |
Creates a new WU_PortfolioStats instance.
- Parameters
-
| initial_cash | Initial cash amount |
| risk_free_rate | Annual risk-free rate for Sharpe/Sortino calculations (e.g., 0.03 for 3%) |
Definition at line 295 of file stats.c.
◆ wu_strdup()
| char * wu_strdup |
( |
const char * | s | ) |
|
|
static |