Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
TSATypeDef.h
1 /* ===================================================================
2 *
3 * T R A D I N G S Y S T E M A P I ™
4 * Copyright © 1999 - 2014 by Peter Ritter ( TradingSystemAPI.com )
5 * A L L R I G H T S R E S E R V E D
6 *
7 * Consult your license regarding permissions and restrictions.
8 * You may obtain a copy of the License at:
9 * http://www.TradingSystemAPI.com/licenses/LICENSE-TSAPI-3.0.html
10 *
11 * ====================================================================
12 */
13 
14 #ifndef TSA_TYPEDEF__INCLUDED
15 #define TSA_TYPEDEF__INCLUDED
16 
17 #ifdef _MSC_VER
18 
19 #if defined(min) || defined(max)
20 #error "min() and/or max() are defined as preprocessor macros.\
21 Define NOMINMAX macro before including any system headers!"
22 #endif
23 
24 #ifndef NOMINMAX
25 #define NOMINMAX
26 #endif
27 
28 #endif // _MSC_VER
29 
30 #include <stddef.h>
31 #include <cstddef>
32 #include <iostream>
33 #include <vector>
34 
35 // Note: See Doxygen PREDEFINED command
36 #if defined (_MSC_VER)
37 # if TSA_COMPILING_DLL
38 # define dll_export __declspec(dllexport)
39 # elif TSA_USING_DLL
40 # define dll_export __declspec(dllimport)
41 # else
42 # define dll_export
43 # endif
44 #else
45 # define dll_export
46 #endif
47 
48 #if defined (_MSC_VER)
49 typedef __int64 int64_t;
50 typedef __int32 int32_t;
51 typedef unsigned __int64 uint64_t;
52 typedef unsigned __int32 uint32_t;
53 #else
54 # include <stdint.h>
55 #endif
56 
57 #ifdef _MSC_VER
58 #if _MSC_VER <= 1800 // VS 2013
59 #define noexcept throw()
60 #endif
61 #endif
62 
63 //#if !defined NDEBUG
64 //#if !defined TSA_DEBUG
65 //# define TSA_DEBUG
66 //#endif
67 //#endif
68 
69 #if defined (_MSC_VER)
70 # pragma warning(disable: 4800) //warning C4800: 'int' : forcing value to bool 'true' or 'false'
71 # pragma warning(disable: 4100) //warning C4100: unreferenced formal parameter
72 #endif
73 
74 
75 namespace tsa {
76  typedef unsigned char Byte;
79 
82 
85  {
86  undefined = 0,
87  created,
90  running,
91  finalized
92  };
93 
95  enum class strategy_end_type {
96  normal,
97  ctrl_c,
98  server_request,
99  exception
100  };
101 
102  std::string to_string(strategy_end_type);
103 
108  };
109 
114  };
115 
117  typedef int64_t identifier_t;
118 
120  const identifier_t undefined_id = (identifier_t)std::pow(2, 53); //largest integer that can safely be stored in a double (as stored by json format)
121 
123  size_t identifier_to_size_t(identifier_t);
124 
126  int identifier_to_int(identifier_t);
127 
129  int size_type_to_int(size_t);
130 
132  const size_t NPOS = ~(size_t)0;
133 
134 #define DB_NIL (-1L) //IU
135  const size_t DB_NPOS = ~(size_t)0; //IU
136  typedef long TSEstoredValue; //IU
137  typedef long TSEoffset; //IU
138  typedef unsigned long TSEspace; //IU
139 
142 
144  struct library {
146  static const char* copyright;
147 
149  static const char* version;
150  };
152 
156  enum seek_result {
158  ok,
163  };
164 
166  enum class _value_types_type { //Note: do not make enum 'class'
167  // Note: do not change sequence nor values!
168  // >> NUMERIC START <<
169  float32 = 1,
170  uint32 = 2,
171  int32 = 3,
172  int64 = 4,
173  float64 = 5,
174  // >> NUMERIC END <<
175  boolean = 6,
176  datetime = 7,
177  date = 8,
178  // >> PTR START <<
179  void_ptr = 9,
180  object_ptr = 10,
181  string = 11,
182  BLOB = 13,
183  // >> PTR STOP <<
184 
185  vt_undefined = 100 // IU - used internally only
186  };
187 
190 
191  // internal use
192  size_t binary_write_size(type_t);
193 
199  std::string to_string(type_t type);
200 
202  bool is_numeric(type_t);
203 
205  bool is_ptr_type(type_t);
206 
209  long_only = 0,
212  other = 3
213  };
214 
216  enum class perf_metric_type {
217  trade_count,
218  loser_count,
219  winner_count,
223  avg_winner,
224  avg_loser,
225  max_loser,
226  max_winner,
242  net_profit,
243  gross_profit,
244  winners_net,
245  losers_net,
249  profit_factor,
269  max_drawdown,
272  avg_drawdown,
273  num_drawdowns,
274  in_drawdown,
285  num_units_traded_other, // internal use
286  risk_free_annual_rate_of_return,
287  start_capital,
289  sharpe_ratio,
291  };
292 
293 
297  struct metric
298  {
299  static const std::vector<std::string> trade_metric_names;
300 
301  static const std::string trade_count;
302  static const std::string loser_count;
303  static const std::string winner_count;
307  static const std::string avg_winner;
308  static const std::string avg_loser;
309  static const std::string max_loser;
310  static const std::string max_winner;
328  static const std::string net_profit;
329  static const std::string gross_profit;
330  static const std::string winners_net;
331  static const std::string losers_net;
335  static const std::string profit_factor;
352 
353  //----------------
354  // equity
355  //----------------
356  static const std::string in_drawdown;
358  static const std::string num_drawdowns;
359  static const std::string max_drawdown;
362  static const std::string avg_drawdown;
365 
366  //----------------
367  // equity (daily combo data)
368  //----------------
374 
375  //----------------
376  // Transactions
377  //----------------
383 
384  //----------------
385  // Units
386  //----------------
392  static const std::string num_units_traded_other; // internal use
393 
394  //----------------
395  // Strategy Metrics
396  //----------------
397 
398  static const std::string drawdown_multiplier;
399 
400  static const std::string sharpe_ratio;
401  static const std::string sortino_ratio;
402 
403  static const std::string basket_num_instruments;
404  static const std::string basket_num_strategies;
405  static const std::string basket_instrument_num_bars_processed;
406  static const std::string basket_strategy_num_bars_processed;
407  static const std::string annual_risk_free_rate_of_return;
408  static const std::string begin_timestamp;
409  static const std::string end_timestamp;
410  static const std::string total_strategy_duration;
411  static const std::string total_instrument_duration;
412  static const std::string source_name;
413  static const std::string source_is_instrument;
414  };
415 
416 
421  };
422 
424  enum log_type_t {
425  no_logs = 0X0,
426  trades = 0X2,
427  transactions = 0X4,
428  bars = 0X8,
429  orders = 0X10,
430  drawdowns = 0X20,
431  all_reports = 0X40
432  };
433 
441 
442 
444  typedef int64_t quantity_t;
445 
447  typedef int64_t position_t;
448 
449 
452 
453  /*
454  ** ====================================================
455  ** >>> class object <<<
456  ** ====================================================
457  */
458 
462  class object {
463  public:
464 
468  object(void) { ; }
469 
473  virtual ~object(void) { ; }//retain virtual for derived rtti info
474  public:
475 
480  const char* class_name(void) const;
481 
487  bool has_same_class_as(const object& other) const;
488  };
490 
491  void assert_failure(const char* msg, const char* file, int line);
492  void verify_failure(const char* msg, const char* file, int line);
493 
494 } // namespace tsa
495 
496 #define TSA__IS_KIND_OF(class_name, pObj) ( dynamic_cast<class_name*>( pObj ) != nullptr )
497 
498 #include <cassert>
499 
500 namespace tsa {
501  namespace unit_test {
502  class DBTests;
503  class CoreTests;
504  }
505 }
506 
507 #include "TSAGlobal.h"
508 
509 #define tsa_declare_testable friend class tsa::unit_test::CoreTests; friend class tsa::unit_test::DBTests;
510 
511 #define tsa_verify(condition) if (condition); \
512 else tsa::verify_failure("___failed: a(" #condition ") ", __FILE__, __LINE__)
513 
514 #define tsa_throw_not_implemented tsa::assert_failure("not implemented", __FILE__, __LINE__);
515 
516 #ifdef TSA_DEBUG
517 
518 #define tsa_assert_kind_of(class_name, object_ptr) \
519  assert(dynamic_cast<class_name*>( object_ptr ) != nullptr)
520 
521 #define tsa_assert_instance_of(class_name, object_ptr) \
522  assert(( object_ptr )->IsInstanceOfClass(#class_name))
523 
524 #define tsa_assert(condition) if (condition); \
525 else tsa::assert_failure("___failed: a(" #condition ") ", __FILE__, __LINE__)
526 
527 #define tsa_fp_are_equal_3(a, b) float64_comparison(a, b, 1e-3)
528 #define tsa_fp_are_equal_6(a, b) float64_comparison(a, b, 1e-6)
529 #define tsa_fp_are_equal_9(a, b) float64_comparison(a, b, 1e-9)
530 #define tsa_fp_are_equal_12(a, b) float64_comparison(a, b, 1e-12)
531 #else
532 #define tsa_assert_kind_of(class_name, pObject) ((void)0)
533 #define tsa_assert_instance_of(class_name, object) ((void)0)
534 #define tsa_assert(x) ((void)0)
535 #define EVAL_ASSERT(x) ((void)0)
536 #define tsa_fp_are_equal_3(a, b) ((void)0)
537 #define tsa_fp_are_equal_6(a, b) ((void)0)
538 #define tsa_fp_are_equal_9(a, b) ((void)0)
539 #endif
540 
541 namespace tsa {
542 
543  /*
544  ** ====================================================
545  ** >>> security_parser <<<
546  ** ====================================================
547  */
548 
549  //Represents a symbol.exchange combination
550  class symbol_exchange_pair_parser : public tsa::object
551  {
552  std::string m_symbol;
553  std::string m_exchange;
554  public:
555  symbol_exchange_pair_parser(void);
556  symbol_exchange_pair_parser(const std::string&);
557  ~symbol_exchange_pair_parser(void);
558  void symbol(const std::string&);
559  void exchange(const std::string&);
560  const std::string& symbol(void)const;
561  const std::string& exchange(void)const;
562  operator std::string(void)const;
563  };
564 
565  /*
566  ** ====================================================
567  ** >>> symbol_parser <<<
568  ** ====================================================
569  */
570 
572  class symbol_parser : public tsa::object
573  {
574  private:
575  static const std::string m_expiry_month_codes;
576  static const std::vector<std::string> m_expiry_months;
577  std::string m_input_string;
578  std::string m_symbol;
579  char m_expiry_code;
580  int m_expiry_year = 0;
581  int m_expiry_month = 0;
582  std::string m_expiry_str;
583  std::string m_expiry_str_yyyymm;
584  std::string m_expiry_month_str;
585  bool m_expires = false;
586  bool m_is_valid = false;
587  void reset(void);
588  protected:
589  bool parse(const std::string& symbol_str);
590  bool only_last_2_char_are_digit(const std::string&)const;
591  int expiry_str_to_expiry_year(const std::string&)const;
592  int month_str_to_month(const std::string& month_str);
593  int expiry_code_to_month(char expiry_code);
594  void verify_expires(void)const;
595  void verify_is_valid(void)const;
596  public:
598  symbol_parser(const std::string& symbol_str);
599 
601  bool expires(void)const;
602 
604  char expiry_month_code(void)const;
605 
607  const std::string& expiry_string(void)const;
608 
610  const std::string& expiry_month_str(void)const;
611 
613  const std::string& expiry_yyyymm_str(void)const;
614 
616  int expiry_year(void)const;
617 
619  int expiry_month(void)const;
620 
622  const std::string& symbol(void)const;
623 
625  std::string product(void)const;
626 
628  std::string db_table_name_part(void)const;
629  };
630 
631  /*
632  ** ====================================================
633  ** >>> exchange_parser <<<
634  ** ====================================================
635  */
636 
639  {
640  std::string m_exchange;
641  std::string m_ccy;
642  bool m_has_ccy = false;
643  void verify_exchange_valid(void)const;
644  public:
646  exchange_parser(const std::string& exchange_str);
647 
649  bool parse(const std::string& exchange_str);
650 
652  bool has_currency(void)const { return m_has_ccy; }
653 
655  const std::string& exchange(void)const;
656 
658  const std::string& currency(void)const;
659  };
660 
661  /*
662  ** ====================================================
663  ** >>> bar_type <<<
664  ** ====================================================
665  */
666 
668  enum class bar_interval_type {
669  undefined = 0,
670  volume = 10,
671  tick,
672  range,
673  fixed_time_bar_type_start = 100,
674  millisecond,
675  second,
676  minute,
677  //hour,
678  day,
679  week,
680  month,
681  year
682  };
683 
685  bool is_fixed_time_bar_type(tsa::bar_interval_type);
686 
688  tsa::bar_interval_type string_to_bar_interval_type(const std::string&);
689 
691  std::string bar_interval_type_to_string(tsa::bar_interval_type);
692 
693 
694  /*
695  ** ====================================================
696  ** >>> bar_def_parser <<<
697  ** ====================================================
698  */
699 
700  class bar_type_parser : public tsa::object
701  {
702  std::string m_bar_type;
703  bar_interval_type m_bar_interval_type = bar_interval_type::undefined;
704  size_t m_bar_interval_size = 0;
705  static std::string class_name;
706  public:
707  bar_type_parser(const std::string& bar_def_str);
708  bool parse(const std::string& bar_def_str);
709  std::string to_string(void)const;
710  void interval_size(size_t sz) { m_bar_interval_size = sz; }
711  void interval_type(tsa::bar_interval_type type) { m_bar_interval_type = type; }
712  bool is_intraday(void)const;
713  tsa::bar_interval_type interval_type(void)const { return m_bar_interval_type; }
714  size_t interval_size(void)const { return m_bar_interval_size; }
715  public:
716  bool parse_bar_type_string(const std::string& bar_type,
717  tsa::bar_interval_type& bar_interval_type, size_t& bar_interval_size);
718  static std::string make_string(
719  tsa::bar_interval_type bar_ival_type, size_t bar_ival_size);
720  };
721 
722  /*
723  ** ====================================================
724  ** >>> ticker_def <<<
725  ** ====================================================
726  */
727  //Represents a 'ticker', a series of quotes from a datafeed
728 
729  class ticker_def {
730  friend class series_def;
731  private:
732  std::string m_type;
733  std::string m_symbol;
734  std::string m_exchange;
735  std::string m_currency;
736  std::string m_feed;
737  std::string m_quote_type = "QTSTD";
738  private:
739  mutable std::string m_combined;
740  bool make_combined(void)const;
741  mutable bool m_string_rep_is_valid = false;
742  public:
743  ticker_def(void);
744  ticker_def(const std::string& symbol,
745  const std::string& exchange, const std::string& feed);
746  ticker_def(const ticker_def&);
747  void operator=(const ticker_def&);
748  ~ticker_def(void);
749 
750  bool is_valid(void)const;
751  const std::string& to_string(void)const;
752  bool expires(void)const;
753  void type(const std::string&);
755  void symbol(const std::string&);
756  std::string expiry_yyyymm(void)const;
758  void exchange(const std::string&);
759  void feed(const std::string&);
760  void quote_type(const std::string&);
761  const std::string& type(void) const;
762  std::string symbol(void) const;
763  std::string exchange(void) const;
764  bool has_currency(void)const;
765  std::string currency(void) const;
766  const std::string& feed(void) const;
767  const std::string& quote_type() const;
768  bool operator== (const ticker_def& other) const;
769  bool operator!= (const ticker_def& other) const;
770  };
771 
772  /*
773  ** ====================================================
774  ** >>> class <<<
775  ** ====================================================
776  */
777 
778  // Represents the information required to represent a series
779  // as managed by series_manager on tsa-server.
780  // It essentially combines a ticker_def with information
781  // on how to aggregate bars
782 
783  class series_def : public tsa::object {
784  tsa_declare_testable;
785  private:
786  std::string m_symbol;
787  std::string m_root_symbol;
788  std::string m_expiry;
789  std::string m_exchange;
790  std::string m_exchange_ccy;
791  std::string m_feed;
792  std::string m_quote_type = "QTSTD";
793  std::string m_bar_type;
794  bar_interval_type m_bar_interval_type = bar_interval_type::undefined;
795  size_t m_bar_interval_size = 0;
796  public:
797  series_def(void);
798  series_def(const std::string& series_def_str);
799  bool operator== (const series_def&) const;
800  std::string to_string(char sep = '|') const;
801  std::string to_server_table_name(void)const;
802  void from_string(const std::string&);
803  bool is_complete(void) const;
804  void bar_interval_size(size_t sz) { m_bar_interval_size = sz; }
805  void bar_interval_type(tsa::bar_interval_type type) { m_bar_interval_type = type; }
806  bool bar_interval_type_is_intraday(void)const;
807  tsa::bar_interval_type bar_interval_type(void)const { return m_bar_interval_type; }
808  size_t bar_interval_size(void)const { return m_bar_interval_size; }
809  std::string expiry(void)const;
810  std::string expiry_yyyymm(void)const;
811  bool expires(void)const;
812  std::string exchange_ccy(void)const;
813  void exchange_ccy(const std::string&);
814  bool exchange_has_ccy(void)const;
815  public:
816  void symbol(const std::string& s);
817  void expiry(const std::string& s);
818  void exchange(const std::string& s);
819  void feed(const std::string& s);
820  void quote_type(const std::string& s);
821  void bar_type(const std::string& s);
822  public:
823  const std::string& symbol(void) const;
824  const std::string& root_symbol(void) const;
825  std::string exchange(void) const;
826  const std::string& feed(void) const;
827  const std::string& quote_type(void) const;
828  std::string bar_type(void) const;
829  public:
830  tsa::ticker_def to_ticker_def(void)const;
831  };
832 
833  /*
834  ** ====================================================
835  ** >>> class <<<
836  ** ====================================================
837  */
838 
839  class instrument_def : public tsa::object {
840  tsa_declare_testable;
841  static std::string class_name;
842  private:
843  std::string m_symbol;
844  std::string m_exchange;
845  std::string m_platform;
846  public:
847  instrument_def(void);
848  instrument_def(const std::string& instr_def_str);
849  bool operator== (const instrument_def&) const;
850  std::string to_string(char sep = '|') const;
851  void from_string(const std::string&);
852  bool is_complete(void) const;
853  std::string symbol_expiry(void)const;
854  bool symbol_expires(void)const;
855  std::string exchange_ccy(void)const;
856  bool exchange_has_ccy(void)const;
857  public:
858  void symbol(const std::string&);
859  void exchange(const std::string&);
860  void platform(const std::string&);
861  public:
862  const std::string& symbol(void) const;
863  std::string exchange(void) const;
864  const std::string& platform(void) const;
865 
866  struct properties {
867  std::string symbol;
868  std::string symbol_expiry;
869  std::string exchange;
870  std::string exchange_ccy;
871  std::string platform;
872  };
873 
874  static std::string make_str(const properties&);
875  };
876 
877  enum ColorCode {
878  c_green,
879  c_snow,
880  c_snow2,
881  c_snow3,
882  c_snow4,
883  c_ghost_white,
884  c_white_smoke,
885  c_gainsboro,
886  c_floral_white,
887  c_old_lace,
888  c_linen,
889  c_antique_white,
890  c_antique_white_2,
891  c_antique_white_3,
892  c_antique_white_4,
893  c_papaya_whip,
894  c_blanched_almond,
895  c_bisque,
896  c_bisque_2,
897  c_bisque_3,
898  c_bisque_4,
899  c_peach_puff,
900  c_peach_puff_2,
901  c_peach_puff_3,
902  c_peach_puff_4,
903  c_navajo_white,
904  c_moccasin,
905  c_cornsilk,
906  c_cornsilk_2,
907  c_cornsilk_3,
908  c_cornsilk_4,
909  c_ivory,
910  c_ivory_2,
911  c_ivory_3,
912  c_ivory_4,
913  c_lemon_chiffon,
914  c_seashell,
915  c_seashell_2,
916  c_seashell_3,
917  c_seashell_4,
918  c_honeydew,
919  c_honeydew_2,
920  c_honeydew_3,
921  c_honeydew_4,
922  c_mint_cream,
923  c_azure,
924  c_alice_blue,
925  c_lavender,
926  c_lavender_blush,
927  c_misty_rose,
928  c_white,
929  c_black,
930  c_dark_slate_gray,
931  c_dim_gray,
932  c_slate_gray,
933  c_light_slate_gray,
934  c_gray,
935  c_light_gray,
936  c_midnight_blue,
937  c_navy,
938  c_cornflower_blue,
939  c_dark_slate_blue,
940  c_slate_blue,
941  c_medium_slate_blue,
942  c_light_slate_blue,
943  c_medium_blue,
944  c_royal_blue,
945  c_blue,
946  c_dodger_blue,
947  c_deep_sky_blue,
948  c_sky_blue,
949  c_light_sky_blue,
950  c_steel_blue,
951  c_light_steel_blue,
952  c_light_blue,
953  c_powder_blue,
954  c_pale_turquoise,
955  c_dark_turquoise,
956  c_medium_turquoise,
957  c_turquoise,
958  c_cyan,
959  c_light_cyan,
960  c_cadet_blue,
961  c_medium_aquamarine,
962  c_aquamarine,
963  c_dark_green,
964  c_dark_olive_green,
965  c_dark_sea_green,
966  c_sea_green,
967  c_medium_sea_green,
968  c_light_sea_green,
969  c_pale_green,
970  c_spring_green,
971  c_lawn_green,
972  c_chartreuse,
973  c_medium_spring_green,
974  c_green_yellow,
975  c_lime_green,
976  c_yellow_green,
977  c_forest_green,
978  c_olive_drab,
979  c_dark_khaki,
980  c_khaki,
981  c_pale_goldenrod,
982  c_light_goldenrod_yellow,
983  c_light_yellow,
984  c_yellow,
985  c_gold,
986  c_light_goldenrod,
987  c_goldenrod,
988  c_dark_goldenrod,
989  c_rosy_brown,
990  c_indian_red,
991  c_saddle_brown,
992  c_sienna,
993  c_peru,
994  c_burlywood,
995  c_beige,
996  c_wheat,
997  c_sandy_brown,
998  c_tan,
999  c_chocolate,
1000  c_firebrick,
1001  c_brown,
1002  c_dark_salmon,
1003  c_salmon,
1004  c_light_salmon,
1005  c_orange,
1006  c_dark_orange,
1007  c_coral,
1008  c_light_coral,
1009  c_tomato,
1010  c_orange_red,
1011  c_red,
1012  c_hot_pink,
1013  c_deep_pink,
1014  c_pink,
1015  c_light_pink,
1016  c_pale_violet_red,
1017  c_maroon,
1018  c_medium_violet_red,
1019  c_violet_red,
1020  c_violet,
1021  c_plum,
1022  c_orchid,
1023  c_medium_orchid,
1024  c_dark_orchid,
1025  c_dark_violet,
1026  c_blue_violet,
1027  c_purple,
1028  c_medium_purple,
1029  c_thistle,
1030  //============
1031  c_auto_color
1032  //============
1033  };
1034 
1035  class color_id;
1036  class variant;
1037 
1041  class dll_export color : public tsa::object
1042  {
1043  friend class color_manager;
1044  private:
1045  bool m_use_default_instead;
1046  private:
1047  int m_red; //0-255
1048  int m_green; //0-255
1049  int m_blue; //0-255
1050  public:
1052  int R(void)const { return m_red; }
1053 
1055  int G(void)const { return m_green; }
1056 
1058  int B(void)const { return m_blue; }
1059 
1061  enum use_default_t { use_default };
1062  public:
1064  color(void);
1065  //IU
1066  color(const tsa::variant&);
1067 
1069  explicit color(unsigned char red, unsigned char green, unsigned char blue);
1070 
1072  explicit color(use_default_t);
1073 
1075  color(const color&);
1076 
1078  explicit color(tsa::ColorCode);
1079 
1081  ~color(void);
1082  public:
1083 
1084  bool IsValid(void)const;
1085  bool UseDefaultInstead(void)const;
1086  int as_int(void)const;
1087  int Difference(const color&)const;
1088  void Rand(void);
1089  color Differentiate(double dPercent)const;
1090  void InitFromInt(int);
1091  bool HasEqualColors(const color& _other)const;
1092  bool IsEqual(const color& _other)const;
1093 
1094  void operator=(const color& _other);
1095  public:
1096  void CopyRGB(const color& _other);
1097  public:
1099  static const color auto_color;
1101  static const color green;
1103  static const color snow;
1105  static const color snow2;
1107  static const color snow3;
1109  static const color snow4;
1111  static const color ghost_white;
1113  static const color white_smoke;
1115  static const color gainsboro;
1117  static const color floral_white;
1119  static const color old_lace;
1121  static const color linen;
1123  static const color antique_white;
1125  static const color antique_white_2;
1127  static const color antique_white_3;
1129  static const color antique_white_4;
1131  static const color papaya_whip;
1133  static const color blanched_almond;
1135  static const color bisque;
1137  static const color bisque_2;
1139  static const color bisque_3;
1141  static const color bisque_4;
1143  static const color peach_puff;
1145  static const color peach_puff_2;
1147  static const color peach_puff_3;
1149  static const color peach_puff_4;
1151  static const color navajo_white;
1153  static const color moccasin;
1155  static const color cornsilk;
1157  static const color cornsilk_2;
1159  static const color cornsilk_3;
1161  static const color cornsilk_4;
1163  static const color ivory;
1165  static const color ivory_2;
1167  static const color ivory_3;
1169  static const color ivory_4;
1171  static const color lemon_chiffon;
1173  static const color seashell;
1175  static const color seashell_2;
1177  static const color seashell_3;
1179  static const color seashell_4;
1181  static const color honeydew;
1183  static const color honeydew_2;
1185  static const color honeydew_3;
1187  static const color honeydew_4;
1189  static const color mint_cream;
1191  static const color azure;
1193  static const color alice_blue;
1195  static const color lavender;
1197  static const color lavender_blush;
1199  static const color misty_rose;
1201  static const color white;
1203  static const color black;
1205  static const color dark_slate_gray;
1207  static const color dim_gray;
1209  static const color slate_gray;
1211  static const color light_slate_gray;
1213  static const color gray;
1215  static const color light_gray;
1217  static const color midnight_blue;
1219  static const color navy;
1221  static const color cornflower_blue;
1223  static const color dark_slate_blue;
1225  static const color slate_blue;
1227  static const color medium_slate_blue;
1229  static const color light_slate_blue;
1231  static const color medium_blue;
1233  static const color royal_blue;
1235  static const color blue;
1237  static const color dodger_blue;
1239  static const color deep_sky_blue;
1241  static const color sky_blue;
1243  static const color light_sky_blue;
1245  static const color steel_blue;
1247  static const color light_steel_blue;
1249  static const color light_blue;
1251  static const color powder_blue;
1253  static const color pale_turquoise;
1255  static const color dark_turquoise;
1257  static const color medium_turquoise;
1259  static const color turquoise;
1261  static const color cyan;
1263  static const color light_cyan;
1265  static const color cadet_blue;
1267  static const color medium_aquamarine;
1269  static const color aquamarine;
1271  static const color dark_green;
1273  static const color dark_olive_green;
1275  static const color dark_sea_green;
1277  static const color sea_green;
1279  static const color medium_sea_green;
1281  static const color light_sea_green;
1283  static const color pale_green;
1285  static const color spring_green;
1287  static const color lawn_green;
1289  static const color chartreuse;
1293  static const color green_yellow;
1295  static const color lime_green;
1297  static const color yellow_green;
1299  static const color forest_green;
1301  static const color olive_drab;
1303  static const color dark_khaki;
1305  static const color khaki;
1307  static const color pale_goldenrod;
1311  static const color light_yellow;
1313  static const color yellow;
1315  static const color gold;
1317  static const color light_goldenrod;
1319  static const color goldenrod;
1321  static const color dark_goldenrod;
1323  static const color rosy_brown;
1325  static const color indian_red;
1327  static const color saddle_brown;
1329  static const color sienna;
1331  static const color peru;
1333  static const color burlywood;
1335  static const color beige;
1337  static const color wheat;
1339  static const color sandy_brown;
1341  static const color tan;
1343  static const color chocolate;
1345  static const color firebrick;
1347  static const color brown;
1349  static const color dark_salmon;
1351  static const color salmon;
1353  static const color light_salmon;
1355  static const color orange;
1357  static const color dark_orange;
1359  static const color coral;
1361  static const color light_coral;
1363  static const color tomato;
1365  static const color orange_red;
1367  static const color red;
1369  static const color hot_pink;
1371  static const color deep_pink;
1373  static const color pink;
1375  static const color light_pink;
1377  static const color pale_violet_red;
1379  static const color maroon;
1381  static const color medium_violet_red;
1383  static const color violet_red;
1385  static const color violet;
1387  static const color plum;
1389  static const color orchid;
1391  static const color medium_orchid;
1393  static const color dark_orchid;
1395  static const color dark_violet;
1397  static const color blue_violet;
1399  static const color purple;
1401  static const color medium_purple;
1403  static const color thistle;
1404  };
1405 
1406 } // namespace tsa
1407 
1408 
1409 namespace std {
1410 
1411  //hash operator for ticker_def
1412  template <>
1413  struct hash <tsa::ticker_def> {
1414  std::size_t operator()(const tsa::ticker_def& td) const {
1415  return std::hash<std::string>()(td.to_string());
1416  }
1417  };
1418 
1419 } //namespace std
1420 
1421 
1422 #endif
Parses symbol:expiry combinations.
Definition: TSATypeDef.h:572
static const color beige
Definition: TSATypeDef.h:1335
static const color dodger_blue
Definition: TSATypeDef.h:1237
static const color saddle_brown
Definition: TSATypeDef.h:1327
double max(const series< double > &series, size_t period)
Returns the highest value found in series over given .
Definition: TSAFunctionsScalar.cpp:180
static const std::string total_commission
The total &#39;commission&#39; booked for trades. (type: double)
Definition: TSATypeDef.h:332
static const std::string avg_drawdown
The value of the average drawdown in the currency in which the securities are traded. (type: double)
Definition: TSATypeDef.h:362
The average gross trade profit / loss (cash amount).
static const std::string avg_transaction_size
The average transaction size in units. (type: double)
Definition: TSATypeDef.h:382
No Logs. (Disables logging - the default setting)
Definition: TSATypeDef.h:425
static const color chartreuse
Definition: TSATypeDef.h:1289
static const color khaki
Definition: TSATypeDef.h:1305
static const color mint_cream
Definition: TSATypeDef.h:1189
static const color dark_orchid
Definition: TSATypeDef.h:1393
static const std::string avg_slippage_per_unit
The average slippage &#39;per unit&#39; traded. (type: double)
Definition: TSATypeDef.h:346
static const color light_cyan
Definition: TSATypeDef.h:1263
static const color deep_pink
Definition: TSATypeDef.h:1371
static const color bisque
Definition: TSATypeDef.h:1135
static const std::string total_loser_bar_count
The number of bars of all losing trades. (type: int64_t)
Definition: TSATypeDef.h:322
static const std::string avg_drawdown__eod
The value of the average drawdown in the currency in which the securities are traded (end of day data...
Definition: TSATypeDef.h:372
static const color olive_drab
Definition: TSATypeDef.h:1301
static const color ivory_2
Definition: TSATypeDef.h:1165
static const color white_smoke
Definition: TSATypeDef.h:1113
static const std::string num_units_traded
The total number of units traded (not &#39;round trip&#39;). (type: int64_t)
Definition: TSATypeDef.h:387
Definition: TSATypeDef.h:106
static const color deep_sky_blue
Definition: TSATypeDef.h:1239
static const std::string percent_bars_in_trade
The percentage of bars during which the strategy had exposure (position not &#39;flat&#39;). (type: double)
Definition: TSATypeDef.h:327
The average net trade profit / loss (cash amount)
static const color antique_white_2
Definition: TSATypeDef.h:1125
static const color papaya_whip
Definition: TSATypeDef.h:1131
The average transaction size in units.
The total number of winning trades.
Commission and slippage are booked per unit.
Definition: TSATypeDef.h:420
static const color bisque_2
Definition: TSATypeDef.h:1137
static const color light_goldenrod
Definition: TSATypeDef.h:1317
The average &#39;per unit&#39; transaction cost (slippage + commission).
static const std::string num_units_traded_at_limit
The number of units traded using &#39;limit orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:391
static const std::string max_loser
The size of the largest losing trade (cash amount). (type: double)
Definition: TSATypeDef.h:309
static const color green_yellow
Definition: TSATypeDef.h:1293
static const std::string total_transaction_cost
The total &#39;transaction cost&#39; for all trades. (type: double)
Definition: TSATypeDef.h:334
Namespace for the &#39;Trading System API&#39; library.
Definition: original1.TSA3Core.cpp:20
object(void)
Constructor.
Definition: TSATypeDef.h:468
const size_t print_no_limit
flag to print without limiting the number of lines printed.
Definition: TSATypeDef.h:78
static const color cornsilk_2
Definition: TSATypeDef.h:1157
The percent of units filled without &#39;slippage&#39;, via &#39;limit-orders&#39;.
The value of the current drawdown.
static const color floral_white
Definition: TSATypeDef.h:1117
static const std::string max_trade_position_size
The maximum position size of any one trade. (type: int64_t)
Definition: TSATypeDef.h:340
static const color hot_pink
Definition: TSATypeDef.h:1369
static const std::string avg_trade_position_size
The average &#39;maximum position size&#39; of all trades. (type: double)
Definition: TSATypeDef.h:342
static const std::string percent_profitable
The percent of trades profitable. (type: double)
Definition: TSATypeDef.h:304
Bar Log.
Definition: TSATypeDef.h:428
static const color dark_goldenrod
Definition: TSATypeDef.h:1321
static const color auto_color
Definition: TSATypeDef.h:1099
static const std::string sum_pos_excursion
The sum of all positive (advantageous) trade profits before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:313
The number of bars of all losing trades.
static const color light_sea_green
Definition: TSATypeDef.h:1281
The size of the largest winning trade (cash amount).
static const color seashell_3
Definition: TSATypeDef.h:1177
static const color light_pink
Definition: TSATypeDef.h:1375
static const color white
Definition: TSATypeDef.h:1201
static const std::string sharpe_ratio
The sharpe ratio. (type: double)
Definition: TSATypeDef.h:400
The maximum number of consecutive losing trades.
static const color sandy_brown
Definition: TSATypeDef.h:1339
static const std::string total_num_bars_processed
The total number of bars processed by the strategy. (type: int64_t)
Definition: TSATypeDef.h:326
Order Log.
Definition: TSATypeDef.h:429
The standard deviation of trade net-profit/loss.
static const color alice_blue
Definition: TSATypeDef.h:1193
static const std::string sortino_ratio
The sortino ratio. (type: double)
Definition: TSATypeDef.h:401
The ratio of &#39;total winners net&#39; / &#39;total losers net&#39;.
seek_result
Return value for seek operations on series tables.
Definition: TSATypeDef.h:156
missing_table_flag_type
Values that represent missing table flag types.
Definition: TSATypeDef.h:111
The strategy &#39;gross profit&#39; (before slippage + commission).
perf_metric_type
Values that represent performance metric types.
Definition: TSATypeDef.h:216
static const color powder_blue
Definition: TSATypeDef.h:1251
static const std::string num_units_traded_at_market
The number of units traded using &#39;market orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:389
The average negative (adverse) trade profit before trade was closed out.
The average slippage &#39;per unit&#39; traded.
static const std::string gross_profit
The strategy &#39;gross profit&#39; (before slippage + commission). (type: double)
Definition: TSATypeDef.h:329
static const color cornsilk_3
Definition: TSATypeDef.h:1159
static const std::string winner_count
The total number of winning trades. (type: int64_t)
Definition: TSATypeDef.h:303
static const color peach_puff_3
Definition: TSATypeDef.h:1147
static const color seashell
Definition: TSATypeDef.h:1173
The average cost (slippage + commission) per trade.
static const char * copyright
Copyright information.
Definition: TSATypeDef.h:146
static const std::string avg_loser_bar_count
The length in bars of the average losing trade. (type: double)
Definition: TSATypeDef.h:323
static const std::string max_neg_excursion
The largest negative (adverse) trade profit before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:316
static const color medium_orchid
Definition: TSATypeDef.h:1391
Drawdown Log.
Definition: TSATypeDef.h:430
static const color moccasin
Definition: TSATypeDef.h:1153
static const color steel_blue
Definition: TSATypeDef.h:1245
Definition: TSASQLite.h:39
static const std::string in_drawdown
Not in use. (type: bool)
Definition: TSATypeDef.h:356
static const std::string avg_winner
The average net profit (cash amount) of winning trades. (type: double)
Definition: TSATypeDef.h:307
static const color spring_green
Definition: TSATypeDef.h:1285
Contains the library&#39;s copyright notice as well as version information.
Definition: TSATypeDef.h:144
The average gross profit/loss per unit.
static const color honeydew_3
Definition: TSATypeDef.h:1185
The total number of bars on which the strategy had exposure (position not &#39;flat&#39;).
static const color light_gray
Definition: TSATypeDef.h:1215
static const color pale_goldenrod
Definition: TSATypeDef.h:1307
strategy_state_type
Values that represent strategy state ts.
Definition: TSATypeDef.h:84
The total number of transactions.
static const color pale_violet_red
Definition: TSATypeDef.h:1377
static const color lemon_chiffon
Definition: TSATypeDef.h:1171
The number of bars of all winning trades.
Represents a symbol/exchange combination.
Definition: TSATypeDef.h:638
static const std::string winners_net
The net profit generated by winning trades. (type: double)
Definition: TSATypeDef.h:330
static const std::string max_closed_out_runup
The highest cummulative gain of sequential winning trades. (type: double)
Definition: TSATypeDef.h:337
structure defining all the metric names. For example, you can pass metric::trade_count as metric_name...
Definition: TSATypeDef.h:297
static const std::string avg_net_profit_per_unit
The average net profit/loss per unit. (type: double)
Definition: TSATypeDef.h:349
static const std::string avg_gain_to_avg_loss_ratio
The ratio of the &#39;average winning trade&#39; / &#39;average losing trade&#39;. (type: double) ...
Definition: TSATypeDef.h:336
static const std::string avg_trade_commission
The average commission per trade. (type: double)
Definition: TSATypeDef.h:343
static const color violet_red
Definition: TSATypeDef.h:1383
static const color cornsilk_4
Definition: TSATypeDef.h:1161
static const std::string max_account_balance
Not in use.
Definition: TSATypeDef.h:363
static const color gainsboro
Definition: TSATypeDef.h:1115
static const std::string current_drawdown
The value of the current drawdown. (type: double)
Definition: TSATypeDef.h:357
static const color salmon
Definition: TSATypeDef.h:1351
static const std::string avg_pos_excursion
The average positive (advantageous) trade profit before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:317
static const color blue_violet
Definition: TSATypeDef.h:1397
static const std::string avg_trade_bar_count
The average trade length in bars. (type: double)
Definition: TSATypeDef.h:324
static const std::string avg_trade_slippage
The average slippage per trade. (type: double)
Definition: TSATypeDef.h:344
static const color peach_puff_4
Definition: TSATypeDef.h:1149
32 bit floating point
Enables all logs.
Definition: TSATypeDef.h:431
32 bit unsigned integer
static const std::string avg_net_trade_pl
The average net trade profit / loss (cash amount). (type: double)
Definition: TSATypeDef.h:305
The average net profit (cash amount) of winning trades.
const size_t max_size_limit
The maximum value for size_t.
Definition: TSATypeDef.h:81
Commission and slippage are booked per transaction.
Definition: TSATypeDef.h:419
The cursor is at the seek timestamp or on next lower timestamp if the seek timestamp was not found...
Definition: TSATypeDef.h:158
static const color rosy_brown
Definition: TSATypeDef.h:1323
static const color royal_blue
Definition: TSATypeDef.h:1233
The percent of trades profitable.
static const color medium_purple
Definition: TSATypeDef.h:1401
int64_t quantity_t
Definition: TSATypeDef.h:444
static const color maroon
Definition: TSATypeDef.h:1379
static const char * version
Version information such as 2.2.2 (major.minor.maintenance)
Definition: TSATypeDef.h:149
The length in bars of the average losing trade.
static const std::string stddev_trade_pl
The standard deviation of trade net-profit/loss. (type: double)
Definition: TSATypeDef.h:319
static const color bisque_4
Definition: TSATypeDef.h:1141
The seek timestamp is higher than the last record in the table.
Definition: TSATypeDef.h:162
static const color ivory_3
Definition: TSATypeDef.h:1167
static const std::string avg_trade_cost
The average cost (slippage + commission) per trade. (type: double)
Definition: TSATypeDef.h:345
static const color dark_turquoise
Definition: TSATypeDef.h:1255
The average &#39;maximum position size&#39; of all trades.
The net loss generated by losing trades.
static const std::string total_slippage
The total &#39;slippage&#39; booked for trades. Trades resulting from &#39;limit orders&#39; have no slippage...
Definition: TSATypeDef.h:333
The number of units traded using &#39;limit orders&#39;.
64 bit floating point
replace_flag_type
Replace / no-replace flag used by various objects.
Definition: TSATypeDef.h:105
static const color honeydew_2
Definition: TSATypeDef.h:1183
static const std::string max_closed_out_rundown
The highest cummulative loss of sequential losing trades. (type: double)
Definition: TSATypeDef.h:338
log_type_t
Log type enumeration. Multiple log types can be combined by using operator|.
Definition: TSATypeDef.h:424
static const color azure
Definition: TSATypeDef.h:1191
_value_types_type type_t
Defines type_t as an alias of enum _value_types_type.
Definition: TSATypeDef.h:189
Definition: TSATypeDef.h:112
The ratio of the &#39;average winning trade&#39; / &#39;average losing trade&#39;.
variant objects can represent values of different types.
Definition: TSAVariant.h:140
Trade Log.
Definition: TSATypeDef.h:426
static const std::string percent_units_without_slippage
The percent of units filled without &#39;slippage&#39;; via &#39;limit-orders&#39;. (type: double) ...
Definition: TSATypeDef.h:348
static const std::string sum_neg_excursion
The sum of all negative (adverse) trade profit before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:314
static const color cyan
Definition: TSATypeDef.h:1261
cost_alloc_type
Transaction cost allocation enumeration.
Definition: TSATypeDef.h:418
static const color medium_spring_green
Definition: TSATypeDef.h:1291
static const color aquamarine
Definition: TSATypeDef.h:1269
_value_types_type
Data type enumeration used throughout the library. Intended to be used via type_t.
Definition: TSATypeDef.h:166
static const color gold
Definition: TSATypeDef.h:1315
Class tsa::exception used by most classes of the Trading System API library. The class inherits from ...
Definition: TSAError.h:37
static const std::string net_profit
The strategy &#39;net profit&#39; (after slippage + commission). (type: double)
Definition: TSATypeDef.h:328
static const color turquoise
Definition: TSATypeDef.h:1259
static const color snow2
Definition: TSATypeDef.h:1105
static const color dark_violet
Definition: TSATypeDef.h:1395
static const color medium_aquamarine
Definition: TSATypeDef.h:1267
static const color pink
Definition: TSATypeDef.h:1373
static const std::string avg_trade_transaction_count
The average number of transactions per trade. (type: double)
Definition: TSATypeDef.h:341
static const color chocolate
Definition: TSATypeDef.h:1343
static const color lavender_blush
Definition: TSATypeDef.h:1197
static const color medium_blue
Definition: TSATypeDef.h:1231
static const std::string min_account_balance
Not in use.
Definition: TSATypeDef.h:364
static const color antique_white
Definition: TSATypeDef.h:1123
static const color light_goldenrod_yellow
Definition: TSATypeDef.h:1309
static const color dark_salmon
Definition: TSATypeDef.h:1349
The seek timestamp is earlier than the first record in the table.
Definition: TSATypeDef.h:160
Parent class for many library classes.
Definition: TSATypeDef.h:462
static const color snow3
Definition: TSATypeDef.h:1107
The value of the largest drawdown.
static const color medium_sea_green
Definition: TSATypeDef.h:1279
static const color antique_white_3
Definition: TSATypeDef.h:1127
static const std::string max_drawdown_length
The length in bars of the longest drawdown. (type: int64_t)
Definition: TSATypeDef.h:360
static const color slate_blue
Definition: TSATypeDef.h:1225
static const color blanched_almond
Definition: TSATypeDef.h:1133
The maximum number of transactions for any one trade.
static const color dark_orange
Definition: TSATypeDef.h:1357
static const color medium_violet_red
Definition: TSATypeDef.h:1381
static const color green
Definition: TSATypeDef.h:1101
static const color dark_slate_gray
Definition: TSATypeDef.h:1205
A date of the Gregorian calendar.
Definition: TSATime.h:119
static const std::string avg_neg_excursion
The average negative (adverse) trade profit before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:318
static const std::string num_transactions
The total number of transactions. (type: int64_t)
Definition: TSATypeDef.h:378
static const color ivory_4
Definition: TSATypeDef.h:1169
The average drawdown length in bars.
static const color red
Definition: TSATypeDef.h:1367
static const std::string num_units_traded_without_slippage
The number of units traded without slippage. (Limit orders do not have slippage). (type: int64_t) ...
Definition: TSATypeDef.h:388
static const std::string max_trade_transaction_count
The maximum number of transactions for any one trade. (type: int64_t)
Definition: TSATypeDef.h:339
static const color black
Definition: TSATypeDef.h:1203
static const std::string max_consec_losers
The maximum number of consecutive losing trades. (type: int64_t)
Definition: TSATypeDef.h:312
sref< bool > operator==(numeric_series_cref a, numeric_series_cref b)
comparison.
Definition: TSADSLBase.cpp:130
flag if the last trade was open before the strategy evaluation/simulation was stopped.
static const std::string num_drawdowns__eod
The total number of drawdowns (end of day data). (type: int64_t)
Definition: TSATypeDef.h:373
The maximum number of consecutive winning trades.
The size of the largest losing trade (cash amount).
The total number of transactions resulting from &#39;stop orders&#39;.
The highest cummulative loss of sequential losing trades.
static const color seashell_4
Definition: TSATypeDef.h:1179
The total number of trades.
static const color brown
Definition: TSATypeDef.h:1347
static const color firebrick
Definition: TSATypeDef.h:1345
The total number of units traded (not &#39;round trip&#39;).
The value of the average drawdown in the currency in which the securities are traded.
static const color purple
Definition: TSATypeDef.h:1399
static const std::string max_drawdown_length__eod
The length in bars of the longest drawdown (end of day data). (type: int64_t)
Definition: TSATypeDef.h:370
static const std::string max_drawdown
The value of the largest drawdown. (type: double)
Definition: TSATypeDef.h:359
static const color light_salmon
Definition: TSATypeDef.h:1353
The average trade length in bars.
The number of units traded without slippage. (Limit orders do not have slippage). ...
static const color pale_green
Definition: TSATypeDef.h:1283
static const color ghost_white
Definition: TSATypeDef.h:1111
static const color plum
Definition: TSATypeDef.h:1387
static const color misty_rose
Definition: TSATypeDef.h:1199
static const std::string loser_count
The total number of losing trades. (type: int64_t)
Definition: TSATypeDef.h:302
static const color peach_puff_2
Definition: TSATypeDef.h:1145
The average slippage per trade.
static const color tan
Definition: TSATypeDef.h:1341
The highest cummulative gain of sequential winning trades.
Short trades only.
Definition: TSATypeDef.h:210
static const color medium_slate_blue
Definition: TSATypeDef.h:1227
static const std::string profit_factor
The ratio of &#39;total winners net&#39; / &#39;total losers net&#39;. (type: double)
Definition: TSATypeDef.h:335
Transaction Log.
Definition: TSATypeDef.h:427
virtual ~object(void)
Destructor.
Definition: TSATypeDef.h:473
The average net profit (cash amount) of losing trades.
The number of units traded using &#39;stop orders&#39;.
static const color snow
Definition: TSATypeDef.h:1103
static const color light_coral
Definition: TSATypeDef.h:1361
trade_grouping
Trade aggregation types used by reporting functionality.
Definition: TSATypeDef.h:208
The net profit generated by winning trades.
The total number of drawdowns.
The total &#39;slippage&#39; booked for trades. Trades resulting from &#39;limit orders&#39; have no slippage...
static const std::string trade_count
The total number of trades. (type: int64_t)
Definition: TSATypeDef.h:301
x
Definition: TSCColor.h:23
Definition: TSATypeDef.h:107
static const color thistle
Definition: TSATypeDef.h:1403
static const color medium_turquoise
Definition: TSATypeDef.h:1257
static const std::string max_pos_excursion
The largest positive (advantageous) trade profit before trade was closed out. (type: double) ...
Definition: TSATypeDef.h:315
The strategy &#39;net profit&#39; (after slippage + commission).
static const color coral
Definition: TSATypeDef.h:1359
static const color violet
Definition: TSATypeDef.h:1385
static const color dim_gray
Definition: TSATypeDef.h:1207
static const color orange_red
Definition: TSATypeDef.h:1365
static const color yellow_green
Definition: TSATypeDef.h:1297
Definition: TSATypeDef.h:113
All trades.
Definition: TSATypeDef.h:211
static const color light_slate_gray
Definition: TSATypeDef.h:1211
static const color light_steel_blue
Definition: TSATypeDef.h:1247
static const color dark_sea_green
Definition: TSATypeDef.h:1275
Long trades only.
Definition: TSATypeDef.h:209
static const color forest_green
Definition: TSATypeDef.h:1299
The average positive (advantageous) trade profit before trade was closed out.
static const std::string losers_net
The net loss generated by losing trades. (type: double)
Definition: TSATypeDef.h:331
static const color honeydew_4
Definition: TSATypeDef.h:1187
static const std::string num_transactions_at_limit
The total number of transactions resulting from &#39;limit orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:381
static const color light_slate_blue
Definition: TSATypeDef.h:1229
Represents a color for use in graphics operations.
Definition: TSATypeDef.h:1041
static const color sky_blue
Definition: TSATypeDef.h:1241
static const std::string max_winner
The size of the largest winning trade (cash amount). (type: double)
Definition: TSATypeDef.h:310
static const color antique_white_4
Definition: TSATypeDef.h:1129
static const color sea_green
Definition: TSATypeDef.h:1277
The total number of transactions resulting from &#39;limit orders&#39;.
static const color navajo_white
Definition: TSATypeDef.h:1151
static const color cadet_blue
Definition: TSATypeDef.h:1265
static const color dark_khaki
Definition: TSATypeDef.h:1303
static const std::string total_winner_bar_count
The number of bars of all winning trades. (type: int64_t)
Definition: TSATypeDef.h:321
static const color peach_puff
Definition: TSATypeDef.h:1143
static const std::string avg_gross_profit_per_unit
The average gross profit/loss per unit. (type: double)
Definition: TSATypeDef.h:350
int R(void) const
Red component.
Definition: TSATypeDef.h:1052
static const color pale_turquoise
Definition: TSATypeDef.h:1253
static const std::string num_drawdowns
The total number of drawdowns. (type: int64_t)
Definition: TSATypeDef.h:358
static const color light_blue
Definition: TSATypeDef.h:1249
The total &#39;commission&#39; booked for trades.
static const color sienna
Definition: TSATypeDef.h:1329
static const color yellow
Definition: TSATypeDef.h:1313
static const color dark_green
Definition: TSATypeDef.h:1271
static const std::string max_consec_winners
The maximum number of consecutive winning trades. (type: int64_t)
Definition: TSATypeDef.h:311
static const color dark_slate_blue
Definition: TSATypeDef.h:1223
static const std::string max_drawdown__eod
The value of the largest drawdown (end of day data). (type: double)
Definition: TSATypeDef.h:369
static const color lawn_green
Definition: TSATypeDef.h:1287
static const color snow4
Definition: TSATypeDef.h:1109
static const color orchid
Definition: TSATypeDef.h:1389
static const color blue
Definition: TSATypeDef.h:1235
static const color seashell_2
Definition: TSATypeDef.h:1175
static const std::string avg_winner_bar_count
The length in bars of the average winning trade. (type: double)
Definition: TSATypeDef.h:320
The length in bars of the longest drawdown.
static const std::string num_transactions_at_market
The total number of transactions resulting from &#39;market orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:379
static const std::string avg_cost_per_unit
The average &#39;per unit&#39; transaction cost (slippage + commission). (type: double)
Definition: TSATypeDef.h:347
static const color light_sky_blue
Definition: TSATypeDef.h:1243
static const color orange
Definition: TSATypeDef.h:1355
int64_t identifier_t
type for ID&#39;s
Definition: TSATypeDef.h:117
static const color indian_red
Definition: TSATypeDef.h:1325
int G(void) const
Green component.
Definition: TSATypeDef.h:1055
static const color dark_olive_green
Definition: TSATypeDef.h:1273
static const color midnight_blue
Definition: TSATypeDef.h:1217
The total number of transactions resulting from &#39;market orders&#39;.
The average number of transactions per trade.
static const color slate_gray
Definition: TSATypeDef.h:1209
static const color navy
Definition: TSATypeDef.h:1219
The length in bars of the average winning trade.
static const color cornsilk
Definition: TSATypeDef.h:1155
static const color lime_green
Definition: TSATypeDef.h:1295
static const color ivory
Definition: TSATypeDef.h:1163
use_default_t
Definition: TSATypeDef.h:1061
static const color tomato
Definition: TSATypeDef.h:1363
static const color burlywood
Definition: TSATypeDef.h:1333
int B(void) const
Blue component.
Definition: TSATypeDef.h:1058
static const std::string num_bars_in_trade
The total number of bars on which the strategy had exposure (position not &#39;flat&#39;). (type: int64_t)
Definition: TSATypeDef.h:325
The percentage of bars during which the strategy had exposure (position not &#39;flat&#39;).
static const std::string avg_gross_trade_pl
The average gross trade profit / loss (cash amount). (type: double)
Definition: TSATypeDef.h:306
static const color lavender
Definition: TSATypeDef.h:1195
static const color old_lace
Definition: TSATypeDef.h:1119
The average commission per trade.
static const color goldenrod
Definition: TSATypeDef.h:1319
static const color peru
Definition: TSATypeDef.h:1331
The largest positive (advantageous) trade profit before trade was closed out.
static const std::string avg_loser
The average net profit (cash amount) of losing trades. (type: double)
Definition: TSATypeDef.h:308
static const color gray
Definition: TSATypeDef.h:1213
The largest negative (adverse) trade profit before trade was closed out.
static const color light_yellow
Definition: TSATypeDef.h:1311
int64_t position_t
Definition: TSATypeDef.h:447
The total number of bars processed by the strategy.
static const std::string avg_drawdown_length
The average drawdown length in bars. (type: double)
Definition: TSATypeDef.h:361
The total number of losing trades.
The average net profit/loss per unit.
static const color wheat
Definition: TSATypeDef.h:1337
static const color honeydew
Definition: TSATypeDef.h:1181
static const color cornflower_blue
Definition: TSATypeDef.h:1221
The maximum position size of any one trade.
static const color bisque_3
Definition: TSATypeDef.h:1139
static const std::string avg_drawdown_length__eod
The average drawdown length in bars (end of day data). (type: double)
Definition: TSATypeDef.h:371
The number of units traded using &#39;market orders&#39;.
The total &#39;transaction cost&#39; for all trades.
static const color linen
Definition: TSATypeDef.h:1121
static const std::string num_transactions_on_stop
The total number of transactions resulting from &#39;stop orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:380
static const std::string last_trade_is_open
flag if the last trade was open before the strategy evaluation/simulation was stopped. (type: bool)
Definition: TSATypeDef.h:351
static const std::string num_units_traded_on_stop
The number of units traded using &#39;stop orders&#39;. (type: int64_t)
Definition: TSATypeDef.h:390
open_db_flag_type operator|(open_db_flag_type a, open_db_flag_type b)
Allows multiple fast::database constructor flags to be combined.
Definition: TSADatabase.cpp:40