cnhkmcp 2.1.2__py3-none-any.whl → 2.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. cnhkmcp/__init__.py +126 -125
  2. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/config.json +1 -1
  3. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/get_knowledgeBase_tool/ace_lib.py +4 -0
  4. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_10_Steps_to_Start_on_BRAIN_documentation.json +14 -0
  5. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_Intermediate_Pack_-_Improve_your_Alpha_2_2_documentation.json +174 -0
  6. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_Intermediate_Pack_-_Understand_Results_1_2_documentation.json +167 -0
  7. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_Introduction_to_Alphas_documentation.json +145 -0
  8. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_Introduction_to_BRAIN_Expression_Language_documentation.json +107 -0
  9. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001_WorldQuant_Challenge_documentation.json +56 -0
  10. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/001__Read_this_First_-_Starter_Pack_documentation.json +404 -0
  11. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002_How_to_choose_the_Simulation_Settings_documentation.json +268 -0
  12. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002_Simulate_your_first_Alpha_documentation.json +88 -0
  13. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002__Alpha_Examples_for_Beginners_documentation.json +254 -0
  14. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002__Alpha_Examples_for_Bronze_Users_documentation.json +114 -0
  15. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002__Alpha_Examples_for_Silver_Users_documentation.json +79 -0
  16. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/002__How_BRAIN_works_documentation.json +184 -0
  17. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/003_Clear_these_tests_before_submitting_an_Alpha_documentation.json +388 -0
  18. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/003_Parameters_in_the_Simulation_results_documentation.json +243 -0
  19. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_Group_Data_Fields_documentation.json +69 -0
  20. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_How_to_use_the_Data_Explorer_documentation.json +142 -0
  21. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_Model77_dataset_documentation.json +14 -0
  22. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_Sentiment1_dataset_documentation.json +14 -0
  23. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_Understanding_Data_in_BRAIN_Key_Concepts_and_Tips_documentation.json +182 -0
  24. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/004_Vector_Data_Fields_documentation.json +30 -0
  25. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Crowding_Risk-Neutralized_Alphas_documentation.json +64 -0
  26. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_D0_documentation.json +66 -0
  27. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Double_Neutralization_documentation.json +53 -0
  28. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Fast_D1_Documentation_documentation.json +304 -0
  29. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Investability_Constrained_Metrics_documentation.json +129 -0
  30. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Must-read_posts_How_to_improve_your_Alphas_documentation.json +14 -0
  31. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Neutralization_documentation.json +29 -0
  32. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_RAM_Risk-Neutralized_Alphas_documentation.json +64 -0
  33. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Risk_Neutralization_Default_setting_documentation.json +75 -0
  34. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Risk_Neutralized_Alphas_documentation.json +171 -0
  35. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/005_Statistical_Risk-Neutralized_Alphas_documentation.json +51 -0
  36. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_EUR_TOP2500_Universe_documentation.json +35 -0
  37. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_GLB_TOPDIV3000_Universe_documentation.json +48 -0
  38. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_Getting_Started_China_Research_for_Consultants_Gold_documentation.json +142 -0
  39. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_Getting_started_on_Illiquid_Universes_Gold_documentation.json +46 -0
  40. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_Getting_started_with_USA_TOPSP500_universe_Gold_documentation.json +62 -0
  41. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_Global_Alphas_Gold_documentation.json +66 -0
  42. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/006_India_Alphas_documentation.json +35 -0
  43. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Consultant_Dos_and_Don_ts_documentation.json +35 -0
  44. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Consultant_Features_documentation.json +239 -0
  45. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Consultant_Simulation_Features_documentation.json +149 -0
  46. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Consultant_Submission_Tests_documentation.json +363 -0
  47. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Finding_Consultant_Alphas_documentation.json +333 -0
  48. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Power_Pool_Alphas_documentation.json +14 -0
  49. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Research_Advisory_Program_documentation.json +35 -0
  50. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Starting_Guide_for_Research_Consultants_documentation.json +14 -0
  51. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Visualization_Tool_documentation.json +99 -0
  52. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007_Your_Advisor_-_Kunqi_Jiang_documentation.json +53 -0
  53. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007__Brain_Genius_documentation.json +288 -0
  54. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/007__Single_Dataset_Alphas_documentation.json +41 -0
  55. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/008_Advisory_Theme_Calendar_documentation.json +14 -0
  56. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/008_Multiplier_Rules_documentation.json +14 -0
  57. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/008_Overview_of_Themes_documentation.json +14 -0
  58. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/008_Theme_Calendar_documentation.json +14 -0
  59. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_Combo_Expression_documentation.json +272 -0
  60. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_Global_SuperAlphas_documentation.json +14 -0
  61. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_Helpful_Tips_documentation.json +58 -0
  62. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_Selection_Expression_documentation.json +1546 -0
  63. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_SuperAlpha_Operators_documentation.json +890 -0
  64. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_SuperAlpha_Results_documentation.json +83 -0
  65. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/009_What_is_a_SuperAlpha_documentation.json +261 -0
  66. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/010_BRAIN_API_documentation.json +515 -0
  67. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/010_Documentation_for_ACE_API_Library_Gold_documentation.json +27 -0
  68. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/010__Understanding_simulation_limits_documentation.json +210 -0
  69. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/arithmetic_operators.json +209 -0
  70. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/cross_sectional_operators.json +98 -0
  71. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/group_operators.json +121 -0
  72. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/logical_operators.json +145 -0
  73. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/reduce_operators.json +156 -0
  74. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/special_operators.json +35 -0
  75. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/time_series_operators.json +386 -0
  76. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/transformational_operators.json +61 -0
  77. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/knowledge/vector_operators.json +38 -0
  78. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/vector_db/_manifest.json +302 -0
  79. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/vector_db/_meta.json +1 -0
  80. cnhkmcp/untracked/AI/321/206/320/261/320/234/321/211/320/255/320/262/321/206/320/237/320/242/321/204/342/225/227/342/225/242/vector_db/chroma.sqlite3 +0 -0
  81. cnhkmcp/untracked/APP/Tranformer/Transformer.py +5 -1
  82. cnhkmcp/untracked/APP/Tranformer/ace_lib.py +4 -0
  83. cnhkmcp/untracked/APP/Tranformer/output/Alpha_candidates.json +6008 -1242
  84. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_error.json +1 -1034
  85. cnhkmcp/untracked/APP/Tranformer/output/Alpha_generated_expressions_success.json +47310 -442
  86. cnhkmcp/untracked/APP/ace_lib.py +4 -0
  87. cnhkmcp/untracked/APP/give_me_idea/ace_lib.py +4 -0
  88. cnhkmcp/untracked/APP/hkSimulator/ace_lib.py +4 -0
  89. cnhkmcp/untracked/APP/simulator/wqb20260107015647.log +57 -0
  90. cnhkmcp/untracked/APP//321/207/342/225/235/320/250/321/205/320/230/320/226/321/204/342/225/225/320/220/321/211/320/221/320/243/321/206/320/261/320/265/ace_lib.py +4 -0
  91. cnhkmcp/untracked/APP//321/207/342/225/235/320/250/321/205/320/230/320/226/321/204/342/225/225/320/220/321/211/320/221/320/243/321/206/320/261/320/265/brain_alpha_inspector.py +2 -2
  92. cnhkmcp/untracked/APP//321/210/342/224/220/320/240/321/210/320/261/320/234/321/206/320/231/320/243/321/205/342/225/235/320/220/321/206/320/230/320/241.py +4 -0
  93. cnhkmcp/untracked/__init__.py +0 -0
  94. cnhkmcp/untracked/mcp/321/206/320/246/320/227/321/204/342/225/227/342/225/242/321/210/320/276/342/225/221/321/205/320/255/320/253/321/207/320/231/320/2302_/321/205/320/266/320/222/321/206/320/256/320/254/321/205/320/236/320/257/321/207/320/231/320/230/321/205/320/240/320/277/321/205/320/232/320/270/321/204/342/225/225/320/235/321/204/342/225/221/320/226/321/206/342/225/241/320/237/321/210/320/267/320/230/321/205/320/251/320/270/321/205/342/226/221/342/226/222/321/210/320/277/320/245/321/210/342/224/220/320/251/321/204/342/225/225/320/272/platform_functions.py +352 -166
  95. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.4.dist-info}/METADATA +1 -1
  96. cnhkmcp-2.1.4.dist-info/RECORD +190 -0
  97. cnhkmcp-2.1.2.dist-info/RECORD +0 -111
  98. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.4.dist-info}/WHEEL +0 -0
  99. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.4.dist-info}/entry_points.txt +0 -0
  100. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.4.dist-info}/licenses/LICENSE +0 -0
  101. {cnhkmcp-2.1.2.dist-info → cnhkmcp-2.1.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,515 @@
1
+ {
2
+ "id": "brain-api",
3
+ "title": "BRAIN API",
4
+ "lastModified": "2025-07-31T04:09:42.120454-04:00",
5
+ "content": [
6
+ {
7
+ "type": "TEXT",
8
+ "value": "<p></p><p>The BRAIN platform sports a rich API library you can use to automate <a href=\"https://www.tutorialspoint.com/http/http_requests.htm\">requests</a> to perform certain actions, such as testing alpha expressions with a range of values.</p><p>This document will detail a few common actions, such as how to sign in and send an alpha for simulation using the API, as well as describe the API behind these actions. We will use Python’s <a href=\"https://requests.readthedocs.io/en/latest/\">Requests</a> library to illustrate these examples, but you can communicate with the API <a href=\"https://en.wikipedia.org/wiki/Web_API\">endpoints</a> using any programming language you prefer.</p>",
9
+ "id": "5ffcf4ef-35c6-4020-9d74-eb0eceaf8749"
10
+ },
11
+ {
12
+ "type": "HEADING",
13
+ "value": {
14
+ "level": "1",
15
+ "content": "Examples"
16
+ },
17
+ "id": "8b27f6d0-d9ed-4597-9308-2db0b1bab7e5"
18
+ },
19
+ {
20
+ "type": "HEADING",
21
+ "value": {
22
+ "level": "2",
23
+ "content": "Signing In"
24
+ },
25
+ "id": "ff49109e-b60d-43a8-9cfe-f648913fd26f"
26
+ },
27
+ {
28
+ "type": "TEXT",
29
+ "value": "<p>To sign in to the platform, invoke the /authentication endpoint using a POST request with a <a href=\"https://en.wikipedia.org/wiki/Basic_access_authentication\">basic authorization header</a>. An example using the Python Requests is shown below.</p>",
30
+ "id": "7a5abbb4-b5d7-4522-b638-71e6a6b85dc0"
31
+ },
32
+ {
33
+ "type": "TEXT",
34
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nimport requests\r\nimport json\r\nfrom os.path import expanduser\r\n\r\n# Create a session to persistently store the headers\r\ns = requests.Session()\r\n\r\n# Save credentials from JSON file in home directory into session\r\nwith open(expanduser('~/.brain_credentials'), 'r') as f:\r\n s.auth = tuple(json.load(f))\r\n\r\n# Send a POST request to the /authentication API\r\nresponse = s.post('https://api.worldquantbrain.com/authentication')\r\n</code>\r\n<br>",
35
+ "id": "06f8ca8a-4f2d-47ce-a338-370f1f66e591"
36
+ },
37
+ {
38
+ "type": "TEXT",
39
+ "value": "<p>You can create a JSON file with the name '.brain_credentials' in your home directory to store your credentials for use in the code above. An example of the JSON file contents can be as follows:</p><p></p><p>[\"&lt;email&gt;\",\"&lt;password&gt;\"]</p>",
40
+ "id": "896e5ea2-64f1-4f18-a77a-5b96360c2331"
41
+ },
42
+ {
43
+ "type": "TEXT",
44
+ "value": "<p>If the query is successful, a <a href=\"https://en.wikipedia.org/wiki/JSON_Web_Token\">JSON Web Token</a> (JWT) is returned that you can use as a header for subsequent requests and is cached by the session.</p><p></p>",
45
+ "id": "357c28eb-8803-4ecb-8c21-7cbef4136ff1"
46
+ },
47
+ {
48
+ "type": "HEADING",
49
+ "value": {
50
+ "level": "2",
51
+ "content": "Biometrics Sign In"
52
+ },
53
+ "id": "8c491cd6-af84-4870-99b8-fde33fccf544"
54
+ },
55
+ {
56
+ "type": "TEXT",
57
+ "value": "<p>If you have biometrics sign in enabled, the above request will return with a “<a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Status\">status code</a> 401” response, as well as a header location that you need to access through the browser to proceed with the biometric authentication.</p>",
58
+ "id": "60e78cce-f48b-4e48-b1c5-370e3a594afe"
59
+ },
60
+ {
61
+ "type": "TEXT",
62
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nWWW-Authenticate: persona\r\nLocation: /authentication/persona?inquiry=inq_ZQZkqAXPqQL7Vym9aPELnghV\r\n</code>\r\n<br>",
63
+ "id": "7107e5a9-e406-45ce-a3d7-e69a20f865ec"
64
+ },
65
+ {
66
+ "type": "TEXT",
67
+ "value": "<p>You will have to access the abovementioned location through the browser. In this example, the URL will be https://api.worldquantbrain.com/authentication/persona?inquiry=inq_ZQZkqAXPqQL7Vym9aPELnghV, which you can obtain by combining the response URL and the Location header as below:</p>",
68
+ "id": "7fca0905-b1d3-4fa8-a88c-98f2f2724b67"
69
+ },
70
+ {
71
+ "type": "TEXT",
72
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nfrom urllib.parse import urljoin\r\n\r\n# Check status code for next action\r\nif response.status_code == requests.status_codes.codes.unauthorized:\r\n if response.headers[\"WWW-Authenticate\"] == \"persona\":\r\n # Outputs the URL to access through the browser to complete biometrics authentication\r\n input(\"Complete biometrics authentication and press any key to continue: \" + urljoin(response.url, response.headers[\"Location\"]))\r\n s.post(urljoin(response.url, response.headers[\"Location\"]))\r\n else:\r\n print(\"incorrect email and password\")\r\n</code>\r\n<br>",
73
+ "id": "6d610de3-c26a-42ca-8bf1-bada22abd3cd"
74
+ },
75
+ {
76
+ "type": "HEADING",
77
+ "value": {
78
+ "level": "2",
79
+ "content": "Simulating an Alpha"
80
+ },
81
+ "id": "5d8f2d67-8ed1-428c-869c-5c6c9c143428"
82
+ },
83
+ {
84
+ "type": "TEXT",
85
+ "value": "<p>After finishing authentication, you can send alphas for simulation by sending a JSON object consisting of the settings of the simulation and the expression through a POST request to the /simulations API endpoint.</p>",
86
+ "id": "952cd6f3-892e-42ab-b915-6bce0f500703"
87
+ },
88
+ {
89
+ "type": "TEXT",
90
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nsimulation_data = {\r\n 'type': 'REGULAR',\r\n 'settings': {\r\n 'instrumentType': 'EQUITY',\r\n 'region': 'USA',\r\n 'universe': 'TOP3000',\r\n 'delay': 1,\r\n 'decay': 15,\r\n 'neutralization': 'SUBINDUSTRY',\r\n 'truncation': 0.08,\r\n 'maxTrade': 'ON',\r\n 'pasteurization': 'ON',\r\n 'testPeriod': 'P1Y6M',\r\n 'unitHandling': 'VERIFY',\r\n 'nanHandling': 'OFF',\r\n 'language': 'FASTEXPR',\r\n 'visualization': False,\r\n },\r\n 'regular': 'close'\r\n}\r\nsimulation_response = s.post('https://api.worldquantbrain.com/simulations', json=simulation_data)\r\n</code>\r\n<br>",
91
+ "id": "98b51ada-3e0f-46c4-87d1-7cc90b7a19df"
92
+ },
93
+ {
94
+ "type": "HEADING",
95
+ "value": {
96
+ "level": "2",
97
+ "content": "Waiting for an Alpha Simulation to End and Retrieving Results"
98
+ },
99
+ "id": "d9078f48-b536-422f-9186-20be25bf6582"
100
+ },
101
+ {
102
+ "type": "TEXT",
103
+ "value": "<p>You can check the progress of the simulation of the alpha by sending a GET request to the URL provided by the HTTP response returned when sending an alpha for simulation, under the header “Location.” If the alpha is still in the midst of simulation, a “Retry-After” header is returned and the script should wait for the specified amount of seconds before querying the URL again.</p><p>Once the simulation finishes, the response to the GET request will include a JSON object in the body where you can retrieve the alpha id in the “alpha” field, which you can then pass on to the /alphas API endpoint to retrieve the result.</p><p></p><p></p>",
104
+ "id": "fe5ff521-a54a-4c60-8aef-fd2a49f0e2c4"
105
+ },
106
+ {
107
+ "type": "TEXT",
108
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nfrom time import sleep\r\n\r\nsimulation_progress_url = simulation_response.headers['Location']\r\nfinished = False\r\nwhile True:\r\n simulation_progress = s.get(simulation_progress_url)\r\n if simulation_progress.headers.get(\"Retry-After\", 0) == 0:\r\n break\r\n print(\"Sleeping for \" + simulation_progress.headers[\"Retry-After\"] + \" seconds\")\r\n sleep(float(simulation_progress.headers[\"Retry-After\"]))\r\nprint(\"Alpha done simulating, getting alpha details\")\r\nalpha_id = simulation_progress.json()[\"alpha\"]\r\nalpha = s.get(\"https://api.worldquantbrain.com/alphas/\" + alpha_id)\r\n</code>\r\n<br>",
109
+ "id": "25c15d2c-3887-4fb3-bacc-37dfde6976f6"
110
+ },
111
+ {
112
+ "type": "HEADING",
113
+ "value": {
114
+ "level": "2",
115
+ "content": "Getting Record Sets of Alpha Simulations"
116
+ },
117
+ "id": "073a6ff9-ef73-4d9b-aa7b-c202f4d16cb8"
118
+ },
119
+ {
120
+ "type": "TEXT",
121
+ "value": "<p>You can obtain the record set containing the information of your simulations, such as PnL and Sharpe ratio, for each trading day by sending a GET request to the /alphas/&lt;alpha_id&gt;/recordsets/&lt;record set name&gt;.</p><p>The example code below shows how to obtain PnL information over the simulation period</p><p></p>",
122
+ "id": "13f56331-6c49-48e6-9f1c-9ec702e0569e"
123
+ },
124
+ {
125
+ "type": "TEXT",
126
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nfrom time import sleep\r\n\r\nfinished = False\r\nwhile True:\r\n pnl = s.get(\"https://api.worldquantbrain.com/alphas/\" + alpha_id + \"/recordsets/pnl\")\r\n if pnl.headers.get(\"Retry-After\", 0) == 0:\r\n break\r\n print(\"Sleeping for \" + pnl.headers[\"Retry-After\"] + \" seconds\")\r\n sleep(float(pnl.headers[\"Retry-After\"]))\r\nprint(\"PnL retrieved\")\r\n</code>\r\n<br>",
127
+ "id": "c4f322a7-bd3e-4386-9622-33d04ad0c953"
128
+ },
129
+ {
130
+ "type": "HEADING",
131
+ "value": {
132
+ "level": "1",
133
+ "content": "API Documentation"
134
+ },
135
+ "id": "60560ae0-4f25-4a5e-a34b-e684cb909e58"
136
+ },
137
+ {
138
+ "type": "HEADING",
139
+ "value": {
140
+ "level": "2",
141
+ "content": "/authentication"
142
+ },
143
+ "id": "a10226c0-4fad-4e03-bb55-78282efd1300"
144
+ },
145
+ {
146
+ "type": "TEXT",
147
+ "value": "<p><b>GET</b></p><p>Retrieves the current state of the client’s authentication.</p>",
148
+ "id": "821762f6-4601-4840-9035-8a2946fdbfbc"
149
+ },
150
+ {
151
+ "type": "TEXT",
152
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nGET /authentication\r\nCookie: jwt=&lt;JWT&gt;\r\n</code>\r\n<br>\r\n\r\n<u>Response:</u>",
153
+ "id": "07171ea3-620c-4abb-9473-2c201089e06b"
154
+ },
155
+ {
156
+ "type": "TEXT",
157
+ "value": "<p>If the client is not currently authenticated:</p>",
158
+ "id": "181d3e68-15f9-489b-852b-4665674d7a6b"
159
+ },
160
+ {
161
+ "type": "TEXT",
162
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n204 No Content\r\n</code>\r\n<br>",
163
+ "id": "d40f80b6-b105-4c18-a680-26fed65d24c4"
164
+ },
165
+ {
166
+ "type": "TEXT",
167
+ "value": "<p>If the client is currently authenticated, then the user id and token expiry information is returned:</p>",
168
+ "id": "0706d401-dd7f-4a90-9ae7-4a3205d4bf0b"
169
+ },
170
+ {
171
+ "type": "TEXT",
172
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 OK\r\n{\r\n \"user\": {\r\n \"id\": \"&lt;string:user id&gt;\"\r\n },\r\n \"token\": {\r\n \"expiry\": &lt;number:time until expiry in seconds&gt;\r\n },\r\n \"permissions\": [\r\n \"PERMISSION\",\r\n \"...\"\r\n ]\r\n}\r\n</code>\r\n<br>",
173
+ "id": "f9175eaa-075c-46e9-ae66-62426685cc6d"
174
+ },
175
+ {
176
+ "type": "TEXT",
177
+ "value": "<p><b>POST</b></p><p>Authenticates the client using basic authentication. The user may be required to solve a <a href=\"https://developers.google.com/recaptcha/docs/display#js_api\">reCAPTCHA</a> and then be locked out if they have had too many authentication attempts. The client is notified if a reCAPTCHA is required in the response to an unsuccessful POST.</p><p>If a user requires web authentication, a 401 message is returned with a response body containing the credential create or GET options.</p>",
178
+ "id": "ff0f3d2f-3b6e-4898-bf7b-54a2d238ea6b"
179
+ },
180
+ {
181
+ "type": "TEXT",
182
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nPOST /authentication\r\nAuthorization: Basic &lt;Base64(user email:password)&gt;\r\n{\r\n \"recaptcha\": \"&lt;string:reCAPTCHA response if required&gt;\"\r\n \"expiry\": \"&lt;number:time until expiry in seconds, must be between 1 and 14400&gt;\"\r\n}\r\n</code>\r\n<br>\r\n<u>Response:</u>",
183
+ "id": "04fe0191-33ff-489e-9e62-f32e84c8805b"
184
+ },
185
+ {
186
+ "type": "TEXT",
187
+ "value": "<p>If the authentication is successful, the authentication cookie is set and the user id and token expiry information is returned:</p>",
188
+ "id": "b5676767-1128-4ad9-b8ce-a5de7e5b8d69"
189
+ },
190
+ {
191
+ "type": "TEXT",
192
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n201 Created\r\nSet-Cookie: t=&lt;JWT&gt;; httponly; Path=/; secure\r\n{\r\n \"user\": {\"id\": \"&lt;string:user id&gt;\"},\r\n \"token\": {\"expiry\": &lt;number:time until expiry in seconds&gt;},\r\n \"permissions\": [\"PERMISSION\", \"...\"]\r\n}\r\n</code>\r\n<br>",
193
+ "id": "9684e282-c638-4033-a695-787fca911b3d"
194
+ },
195
+ {
196
+ "type": "TEXT",
197
+ "value": "<p>If the credentials are invalid:</p>",
198
+ "id": "5a93c4cf-18f8-4fa5-9e04-27e2684a1d76"
199
+ },
200
+ {
201
+ "type": "TEXT",
202
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n401 Unauthorized\r\n{\r\n \"detail\": \"&lt;unauthorized code&gt;\"\r\n}\r\n</code>\r\n<br>",
203
+ "id": "28555c95-bd7c-450a-9805-2a0d853d5774"
204
+ },
205
+ {
206
+ "type": "TEXT",
207
+ "value": "<p>If the credentials are invalid and a reCAPTCHA is required:</p>",
208
+ "id": "29f9df01-2b4e-467a-81be-d470e3b8a0d3"
209
+ },
210
+ {
211
+ "type": "TEXT",
212
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n401 Unauthorized\r\n{\r\n \"detail\": \"&lt;unauthorized code&gt;\",\r\n \"recaptcha\": [\r\n \"This field is required.\"\r\n ]\r\n}\r\n</code>\r\n<br>",
213
+ "id": "913008d7-9945-4672-af4c-a599e0f6a059"
214
+ },
215
+ {
216
+ "type": "TEXT",
217
+ "value": "<p><b>DELETE</b></p><p>Deletes the authentication state by deleting the authentication cookie and invalidating the JWT.</p>",
218
+ "id": "26436276-a834-4d04-b66f-ec71c3a79911"
219
+ },
220
+ {
221
+ "type": "TEXT",
222
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nDELETE /authentication\r\nCookie: t=&lt;JWT&gt;\r\n</code>\r\n<br>\r\n<u>Response:</u>",
223
+ "id": "a053b498-aab3-491d-8091-0275baec0a3a"
224
+ },
225
+ {
226
+ "type": "TEXT",
227
+ "value": "<p>If deleting authentication state is successful:</p>",
228
+ "id": "eb8ae67f-a4cb-462f-bf21-6bb32f6d1fe1"
229
+ },
230
+ {
231
+ "type": "TEXT",
232
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n204 OK\r\nSet-Cookie:t=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/\r\n{\r\n}\r\n</code>\r\n<br>",
233
+ "id": "4d88b002-dfd2-4f91-800c-61f0d6d02ac0"
234
+ },
235
+ {
236
+ "type": "TEXT",
237
+ "value": "<p>If the authentication status is invalid:</p>",
238
+ "id": "d8457558-8df8-4d81-9783-68b6d79cf696"
239
+ },
240
+ {
241
+ "type": "TEXT",
242
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n401 Unauthorized\r\n{\r\n \"detail\": \"INVALID_CREDENTIALS\"\r\n}\r\n</code>\r\n<br>",
243
+ "id": "c9be7f83-581d-48c6-ace3-1be0d08b4468"
244
+ },
245
+ {
246
+ "type": "HEADING",
247
+ "value": {
248
+ "level": "2",
249
+ "content": "/simulations"
250
+ },
251
+ "id": "e149fb0d-373e-413a-858e-c5e2352b33b3"
252
+ },
253
+ {
254
+ "type": "TEXT",
255
+ "value": "<p><b>OPTIONS</b></p><p>Gets the details about the available properties, their types, requirements and allowed values.</p>",
256
+ "id": "ebec90cb-fe9d-4af9-b9df-d5979074ca56"
257
+ },
258
+ {
259
+ "type": "TEXT",
260
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nOPTIONS /simulations\r\n</code>\r\n<br>\r\n<u>Response:</u>",
261
+ "id": "ee0d83fe-a39f-4a42-a64a-1730507f5cd8"
262
+ },
263
+ {
264
+ "type": "TEXT",
265
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 Ok\r\n{\r\n actions: {\r\n POST: {\r\n id: {\r\n type: \"string\",\r\n required: false,\r\n readOnly: true\r\n },\r\n ...\r\n}\r\n</code>\r\n<br>",
266
+ "id": "074b5f14-4b0f-43a2-8988-ddcaed8e7566"
267
+ },
268
+ {
269
+ "type": "TEXT",
270
+ "value": "<p><b>POST</b></p><p>Creates a new simulation.</p>",
271
+ "id": "d17fcc6a-9042-49b1-9309-c7316e428cc1"
272
+ },
273
+ {
274
+ "type": "TEXT",
275
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nPOST /simulations\r\n{\r\n \"type\": \"&lt;string: the simulation type: REGULAR or SUPER&gt;\",\r\n \"settings\": {\r\n \"instrumentType\": \"&lt;string: the simulation instrument type, see OPTIONS for a list of available instrument type&gt;\",\r\n \"region\": \"&lt;string: the simulation region, see OPTIONS for a list of available regions&gt;\",\r\n \"universe\": \"&lt;string: the simulation universe, see OPTIONS for a list of available universes&gt;\",\r\n \"delay\": &lt;number: 0 or 1 delay&gt;,\r\n \"decay\": &lt;number: the decay&gt;,\r\n \"neutralization\": \"&lt;string: the simulation neutralization, see OPTIONS for a list of available neutralizations&gt;\",\r\n \"truncation\": &lt;number: the truncation&gt;,\r\n \"pasteurization\": \"&lt;string: the simulation pasteurization, see OPTIONS for list of available pasteurization&gt;\",\r\n “testPeriod\": \"&lt; string: Duration. Example: P1Y6M &gt;\",\r\n \"unitHandling\": \"&lt;string: the simulation unit handling, see OPTIONS for list of available unit handling&gt;\",\r\n \"nanHandling\": \"&lt;string: the simulation NaN handling, see OPTIONS for list of available NaN handling&gt;\",\r\n \"selectionHandling\": \"&lt;string: the selection handling for the SUPER simulations, see OPTIONS for a list of available selection handling&gt;\",\r\n \"selectionLimit\": \"&lt;string: the selection limit for the SUPER simulations&gt;\",\r\n \"language\": \"&lt;string: the language, see OPTIONS for a list of available languages&gt;\",\r\n \"visualization\": &lt;boolean: the visualization&gt;,\r\n }\r\n \"regular\": \"&lt;string: the code for the REGULAR simulation&gt;\"\r\n \"combo\": \"&lt;string: the combo for the SUPER simulation&gt;\"\r\n \"selection\": \"&lt;string: the selection for the SUPER simulation&gt;\"\r\n}\r\n</code>\r\n<br>",
276
+ "id": "681dc23c-57be-472a-bb16-54b955be716f"
277
+ },
278
+ {
279
+ "type": "TEXT",
280
+ "value": "<p>Multiple simulations can be run by posting an array of length 2..10 of the above simulation objects. The user requires the MULTI_SIMULATION permission to allow multiple simulations. See /authentication to get the user’s permissions. Also the settings for the simulation must be compatible, they must have the same simulation type, instrument type, region, delay and language.</p>",
281
+ "id": "0fbb7bb4-b8b0-43bc-8694-613942bad29a"
282
+ },
283
+ {
284
+ "type": "TEXT",
285
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n[\r\n {\"type\":\"REGULAR\",...},\r\n {\"type\":\"REGULAR\",...},\r\n ...\r\n]\r\n</code>\r\n<br>",
286
+ "id": "198ac8ee-177d-4c7e-a1a0-2a1907e0d7ad"
287
+ },
288
+ {
289
+ "type": "TEXT",
290
+ "value": "<p>Progress of multi-simulations is tracked by a parent simulation object. A child simulation is created for each of the multi-simulation objects. The list of child simulation ids are available when the parent simulation is complete.</p>",
291
+ "id": "c6e683d9-c03f-4d0e-ac68-563df29395df"
292
+ },
293
+ {
294
+ "type": "TEXT",
295
+ "value": "<u>Response:</u>",
296
+ "id": "bd7623e5-167d-4555-b8ca-664b562d7839"
297
+ },
298
+ {
299
+ "type": "TEXT",
300
+ "value": "<p>If the simulation request was processed successfully, you will get the following response:</p>",
301
+ "id": "8c5dc9ce-f789-4fa3-ab91-5e3a2dd6e75a"
302
+ },
303
+ {
304
+ "type": "TEXT",
305
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n201 Created\r\nLocation: /simulations/&lt;simulation id&gt;\r\n</code>\r\n<br>",
306
+ "id": "298a41b1-aa0a-40f2-85d8-c950851fb0ad"
307
+ },
308
+ {
309
+ "type": "TEXT",
310
+ "value": "<p>Updates to the simulation can be obtained from GET /simulations/&lt;simulation id&gt;. If a request is invalid, an array of validation errors will be returned for each property with an error. For example:</p>",
311
+ "id": "1746413d-cf72-44cc-b589-a6850441bb14"
312
+ },
313
+ {
314
+ "type": "TEXT",
315
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n400 Bad Request\r\n{\r\n \"type\": [\r\n \"\\\"X\\\" is not a valid choice.\"\r\n ],\r\n \"settings\": {\r\n \"region\": [\r\n \"This field is required.\"\r\n ]\r\n }\r\n}\r\n</code>\r\n<br>",
316
+ "id": "029a5b9d-f7f7-4ea8-9355-4d958404512b"
317
+ },
318
+ {
319
+ "type": "TEXT",
320
+ "value": "<p><b>GET</b></p><p>Retrieves the current state of simulation.</p>",
321
+ "id": "12b61bd8-73e4-4300-8b3c-580532ad0455"
322
+ },
323
+ {
324
+ "type": "TEXT",
325
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nGET /simulations/&lt;simulation id&gt;\r\n</code>\r\n<br>\r\n<u>Response:</u>",
326
+ "id": "6061ccf9-681e-4a99-9f3a-7c55ea34be23"
327
+ },
328
+ {
329
+ "type": "TEXT",
330
+ "value": "<p>If the simulation is still in progress, the progress is returned:</p>",
331
+ "id": "2435e1e7-b9f6-47eb-b8c2-8ba40e61921e"
332
+ },
333
+ {
334
+ "type": "TEXT",
335
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 OK\r\nRetry-After: &lt;seconds&gt;\r\n{\r\n \"progress\": &lt;number: 0..1 progress of the asynchronous request if available&gt;\r\n}\r\n</code>\r\n<br>",
336
+ "id": "59a56b04-746b-43e9-b6f2-1ab1954a2508"
337
+ },
338
+ {
339
+ "type": "TEXT",
340
+ "value": "<p>If the simulation is complete, the response body matches the POST response body with additional properties below.</p><p>If multiple simulations were submitted, the child simulation ids will be included. The details of the child simulations are available at GET /simulations/&lt;child simulation id&gt;</p>",
341
+ "id": "bf9b9407-96f4-4886-86ba-69e3c743be11"
342
+ },
343
+ {
344
+ "type": "TEXT",
345
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 OK\r\n{\r\n \"id\": \"&lt;string:simulation id&gt;\",\r\n \"parent\": \"&lt;string:parent simulation id if this simulation is a child&gt;\",\r\n \"children\": [ &lt;array: child simulation ids if this simulation is a parent&gt;\r\n \"&lt;string:simulation id&gt;\",\r\n ...\r\n ],\r\n \"status\": \"&lt;string: the simulation status: WAITING, SIMULATING, CANCELLED, COMPLETE, WARNING, ERROR, TIMEOUT, or FAIL&gt;\",\r\n \"message\": \"&lt;string:error message, if the status = ERROR and a message is available&gt;\"\r\n \"location\": { &lt;object: code location if status = ERROR and the error is related to the code&gt;\r\n \"property\": \"&lt;string: the code property with the error: 'regular', 'combo', or 'selection'&gt;\"\r\n \"line\": &lt;number: the line number of the error in the code&gt;,\r\n \"start\": &lt;number: the start column of the error in the line&gt;,\r\n \"end\": &lt;number: the end column of the error in the line&gt;,\r\n }\r\n \"progress\": &lt;number: 0..1 simulation progress if the status = SIMULATING&gt;\r\n \"alpha\": \"&lt;string: the id of the generated Alpha only available when status = COMPLETE or WARNING and simulation type = SIMULATE&gt;\"\r\n ...&lt;the request object data&gt;...\r\n}\r\n</code>\r\n<br>",
346
+ "id": "6b0fbba4-4dec-432e-989b-66459920848a"
347
+ },
348
+ {
349
+ "type": "HEADING",
350
+ "value": {
351
+ "level": "2",
352
+ "content": "/alphas"
353
+ },
354
+ "id": "9ce99d17-8b64-47c7-a927-add29e1544c7"
355
+ },
356
+ {
357
+ "type": "TEXT",
358
+ "value": "<p>This API endpoint manages alphas. Alphas are created by submitting simulations. See /simulations.</p>",
359
+ "id": "d86371b2-17a3-4fb2-ada3-32a27ed9d6a2"
360
+ },
361
+ {
362
+ "type": "TEXT",
363
+ "value": "<p><b>GET</b></p><p>Retrieves the alpha. Alpha ids can be obtained from the alpha of a simulation response object.</p>",
364
+ "id": "8ddf7528-673f-46ef-a30a-a123dbf5dd00"
365
+ },
366
+ {
367
+ "type": "TEXT",
368
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nGET /alphas/&lt;alpha id&gt;\r\n</code>\r\n<br>\r\n<u>Response::</u>",
369
+ "id": "66df6297-4c8a-4320-be85-96bd22f930f8"
370
+ },
371
+ {
372
+ "type": "TEXT",
373
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 OK\r\n{\r\n \"id\": \"&lt;string:alpha id&gt;\",\r\n \"type\": \"&lt;string: the simulation type: REGULAR or SUPER&gt;\",\r\n \"settings\": {\r\n …\r\n }\r\n \"regular\": {\r\n …\r\n },\r\n \"combo\": {\r\n …\r\n },\r\n \"selection\": {\r\n …\r\n },\r\n …\r\n}\r\n</code>\r\n<br>",
374
+ "id": "0af5fa20-c0cb-41fd-9b43-ce0056936136"
375
+ },
376
+ {
377
+ "type": "HEADING",
378
+ "value": {
379
+ "level": "2",
380
+ "content": "/alphas/<alpha_id>/recordsets"
381
+ },
382
+ "id": "361ad83a-04ea-4cd6-bbdf-5f5ef07be3ff"
383
+ },
384
+ {
385
+ "type": "TEXT",
386
+ "value": "<p><b>GET</b></p>",
387
+ "id": "0ed73bc5-5697-4fad-9705-ec4f67ec5ef8"
388
+ },
389
+ {
390
+ "type": "TEXT",
391
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nGET /alphas/&lt;alpha id&gt;/recordsets\r\n</code>\r\n<br>",
392
+ "id": "c30d0c8e-3618-4365-9127-bb8181d0740e"
393
+ },
394
+ {
395
+ "type": "TEXT",
396
+ "value": "<p>Lists the record sets available for the Alpha.</p>",
397
+ "id": "9c503001-4e1c-4cc4-a1fe-d64d0f8cf982"
398
+ },
399
+ {
400
+ "type": "TEXT",
401
+ "value": "<u>Response:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n200 OK\r\n{\r\n \"count\": &lt;number: the number of record sets&gt;,\r\n \"results\": [\r\n {\r\n \"name\": \"&lt;string: the name of the record set&gt;\",\r\n \"title\": \"&lt;string: the human readable name of the record set&gt;\"\r\n },\r\n ...\r\n ]\r\n}\r\n</code>\r\n<br>",
402
+ "id": "b4234df0-958c-41b4-b933-9baa5de38b7d"
403
+ },
404
+ {
405
+ "type": "TEXT",
406
+ "value": "<p>Example including all record sets:</p>",
407
+ "id": "30cf74ca-8d7c-4c6a-980f-3a9310368834"
408
+ },
409
+ {
410
+ "type": "TEXT",
411
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n{\r\n \"count\": 19,\r\n \"results\": [\r\n {\r\n \"name\": \"pnl\",\r\n \"title\": \"PnL\"\r\n },\r\n {\r\n \"name\": \"sharpe\",\r\n \"title\": \"Sharpe\"\r\n },\r\n {\r\n \"name\": \"turnover\",\r\n \"title\": \"Turnover\"\r\n },\r\n {\r\n \"name\": \"daily-pnl\",\r\n \"title\": \"Daily PnL\"\r\n },\r\n {\r\n \"name\": \"yearly-stats\",\r\n \"title\": \"Yearly Stats\"\r\n },\r\n {\r\n \"name\": \"coverage\",\r\n \"title\": \"Coverage of Universe\"\r\n },\r\n {\r\n \"name\": \"coverage-by-industry\",\r\n \"title\": \"Coverage by Industry\"\r\n },\r\n {\r\n \"name\": \"coverage-by-sector\",\r\n \"title\": \"Coverage by Sector\"\r\n },\r\n {\r\n \"name\": \"average-size-by-industry\",\r\n \"title\": \"Average Size by Industry\"\r\n },\r\n {\r\n \"name\": \"average-size-by-sector\",\r\n \"title\": \"Average Size by Sector\"\r\n },\r\n {\r\n \"name\": \"average-size-by-capitalization\",\r\n \"title\": \"Average Size by Capitalization\"\r\n },\r\n {\r\n \"name\": \"pnl-by-industry\",\r\n \"title\": \"PnL by Industry\"\r\n },\r\n {\r\n \"name\": \"pnl-by-sector\",\r\n \"title\": \"PnL by Sector\"\r\n },\r\n {\r\n \"name\": \"pnl-by-capitalization\",\r\n \"title\": \"PnL by Capitalization\"\r\n },\r\n {\r\n \"name\": \"sharpe-by-industry\",\r\n \"title\": \"Sharpe by Industry\"\r\n },\r\n {\r\n \"name\": \"sharpe-by-sector\",\r\n \"title\": \"Sharpe by Sector\"\r\n },\r\n {\r\n \"name\": \"sharpe-by-capitalization\",\r\n \"title\": \"Sharpe by Capitalization\"\r\n },\r\n {\r\n \"name\": \"average-value-by-industry\",\r\n \"title\": \"Abs Average Value by Industry\"\r\n },\r\n {\r\n \"name\": \"average-value-by-sector\",\r\n \"title\": \"Abs Average Value by Sector\"\r\n }\r\n ]\r\n} \r\n</code>\r\n<br>",
412
+ "id": "1a6ff7a5-6ca5-44d1-a961-fd9495446f55"
413
+ },
414
+ {
415
+ "type": "HEADING",
416
+ "value": {
417
+ "level": "2",
418
+ "content": "/alphas/<alpha_id>/recordsets/<record set name>"
419
+ },
420
+ "id": "b0a27c50-6a78-4744-8607-254f61577d23"
421
+ },
422
+ {
423
+ "type": "TEXT",
424
+ "value": "<p><b>GET</b></p>",
425
+ "id": "643589ba-a5db-4b04-8c7b-fbccdbc36377"
426
+ },
427
+ {
428
+ "type": "TEXT",
429
+ "value": "<u>Request:</u>\r\n<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\nGET /alphas/&lt;alpha id&gt;/recordsets/&lt;record set name&gt;\r\n</code>\r\n<br>\r\n<u>Response:</u>",
430
+ "id": "bdb16f6a-17c2-462c-bd30-2d560a130403"
431
+ },
432
+ {
433
+ "type": "TEXT",
434
+ "value": "<p>Retrieves the given record set.</p><p>Depending on the record set there will be different properties:</p>",
435
+ "id": "2d059cdb-143a-4789-9c35-3eb65b8765f2"
436
+ },
437
+ {
438
+ "type": "TEXT",
439
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\npnl: ... date , pnl , sharpe , ...\r\nsharpe: ... date , sharpe , ...\r\ncoverage: ... date , instruments , ...\r\ncoverage-by-industry: ... series , software , chemicals , ... the industries ...\r\ncoverage-by-sector: ... series , technology , financial , ... the sector ...\r\naverage-size-by-capitalization: ... 020 , 2040 , 4060 , 6080 , 80100 , ...\r\naverage-size-by-sector: ... technology , financial , ... the sectors ...\r\naverage-size-by-industry: ... software , chemicals , ... the industries ...\r\npnl-by-capitalization: ... date , pnlDivTwo , 020 , 2040 , 4060 , 6080 , 80100 , ...\r\npnl-by-sector: ... date , pnlDivTwo , technology , basicMaterials , ... the sectors ...\r\npnl-by-industry: ... date , pnlDivTwo , software , chemicals , ... the industries ...\r\nsharpe-by-capitalization: ... 020 , 2040 , 4060 , 6080 , 80100 , ...\r\nsharpe-by-sector: ... technology , basicMaterials , ... the sectors ...\r\nsharpe-by-industry: ... software , chemicals , ... the industries ...\r\naverage-value-by-sector: ... date , technology , basicMaterials , ... the sectors ...\r\naverage-value-by-industry: ... date , software , chemicals , ... the industries ...\r\nturnover: ... date , turnover , ...\r\n</code>\r\n<br>",
440
+ "id": "1ba0bb28-f9dc-4897-a3a2-2095951e0180"
441
+ },
442
+ {
443
+ "type": "HEADING",
444
+ "value": {
445
+ "level": "1",
446
+ "content": "Additional Details"
447
+ },
448
+ "id": "50a6c746-c5a6-446e-8daf-427ba4efae5e"
449
+ },
450
+ {
451
+ "type": "TEXT",
452
+ "value": "<p><b>Record Sets</b></p><p>Some responses include tabular record sets. These can be used for tables and charting. They are encoded efficiently as follows:</p>",
453
+ "id": "c5e9b46f-2fca-477f-ba2e-25ec59fd624d"
454
+ },
455
+ {
456
+ "type": "TEXT",
457
+ "value": "<code style=\"display:block; white-space: pre-wrap; word-wrap:break-word;\">\r\n{\r\n \"schema\": {\r\n \"name\": \"&lt;string: the name of the record set&gt;\",\r\n \"title\": \"&lt;string: the human readable name of the record set&gt;\",\r\n \"properties\": [ &lt;array: the record set properties&gt;\r\n {\r\n \"name\": \"&lt;string: the name of the property&gt;\"\r\n \"title\": \"&lt;string: the human readable name of the property&gt;\"\r\n \"type\": \"&lt;string: data type of the property: string, integer, decimal, amount, percent, permyriad, date, time, datetime, year&gt;\"\r\n },\r\n ...]\r\n \"records\": [ &lt;array: the records&gt;\r\n [\r\n &lt;array: the record property values&gt;\r\n ],\r\n ...]\r\n}\r\n</code>\r\n<br>",
458
+ "id": "77f63750-e227-41ab-941c-974b32605e73"
459
+ },
460
+ {
461
+ "type": "TEXT",
462
+ "value": "<p>The type can be used by the client to format numbers. Amounts are generally formatted in thousands \"1.2K\", millions \"1.2M\", billions \"1.2B\". Percent and permyriad (basis points) are formatted as \"1.23%\", \"1.23‱\" respectively.</p>",
463
+ "id": "347b5899-efa4-49b7-b1d8-5c253422f945"
464
+ },
465
+ {
466
+ "type": "HEADING",
467
+ "value": {
468
+ "level": "2",
469
+ "content": "/users/<userid>/activities/diversity"
470
+ },
471
+ "id": "ba479370-40f1-4850-a7e2-7bfcf70914b6"
472
+ },
473
+ {
474
+ "type": "TEXT",
475
+ "value": "<p></p><p><b>GET</b></p><p>Request:</p><p>/users/&lt;userid&gt;/activities/diversity</p><p>Provide alpha submission breakdown by Region, Delay, and Data Category.</p><p>Return recordset with parameters:</p><p>/users/&lt;userid&gt;/activities/diversity?grouping=region,delay,dataCategory</p><p>Alpha shall belong to a Dataset Category if it uses a data field in a dataset from the Dataset Category.</p><p>Response:</p><p>200 OK</p><p>{</p><p>'alphas': [</p><p>{</p><p>'alphaCount': &lt;integer of alpha count&gt;,</p><p>'delay': &lt;integer of delay&gt;,</p><p>'region': &lt;string of region&gt;,</p><p>'dataCategory': {'name': &lt;string name of data category&gt;, 'id': &lt;string id of data category&gt; }</p><p>},</p><p>...</p><p>],</p><p>'count': &lt;integer of all alpha count&gt;</p><p>}</p>",
476
+ "id": "01f2dcb8-1980-45d1-b8e9-c4d579c010a7"
477
+ },
478
+ {
479
+ "type": "HEADING",
480
+ "value": {
481
+ "level": "1",
482
+ "content": "Troubleshooting common API error messages"
483
+ },
484
+ "id": "1bab5780-84da-4eb1-99aa-5cdc56baca5c"
485
+ },
486
+ {
487
+ "type": "TABLE",
488
+ "value": {
489
+ "data": [
490
+ [
491
+ "Error",
492
+ "Likely cause & resolution"
493
+ ],
494
+ [
495
+ "Invalid data field",
496
+ "A data field was wrongly used in your Alpha expression. Check if you are using vector data fields with vector operators, or if you have included a matrix data field in a vector operator."
497
+ ],
498
+ [
499
+ "Empty output from ace_lib function",
500
+ "Some of your inputs might be invalid. Check through your inputs to the function.\n\nIf the invalid input is a dataset or data field, check if the dataset or data field is still on the platform through the Data Explorer."
501
+ ],
502
+ [
503
+ "Got invalid input at index 0, must be an event data",
504
+ "An invalid input was detected. Check if you are passing a constant into a vector operator."
505
+ ]
506
+ ],
507
+ "firstRowIsTableHeader": true,
508
+ "firstColIsHeader": false
509
+ },
510
+ "id": "d7c3f690-59f0-4c50-b8d0-f64f82b0ab7a"
511
+ }
512
+ ],
513
+ "sequence": 15,
514
+ "category": "BRAIN API"
515
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "id": "documentation-ace-api-library-gold",
3
+ "title": "Documentation for ACE API Library [Gold]",
4
+ "lastModified": "2025-03-07T04:24:41.918309-05:00",
5
+ "content": [
6
+ {
7
+ "type": "HEADING",
8
+ "value": {
9
+ "level": "1",
10
+ "content": "ACE Package and instructions"
11
+ },
12
+ "id": "42d0fd9c-1d44-4d56-8553-8f2ec3c7fa49"
13
+ },
14
+ {
15
+ "type": "TEXT",
16
+ "value": "<h3>Download our Alpha Creation Engine from <a href=\"https://support.worldquantbrain.com/hc/en-us/articles/30469668943767-Alpha-Creation-Engine-API-library-Gold\"><b>here</b></a><h3>",
17
+ "id": "a38c4123-7ebc-4a0f-b5cf-033fff3711dd"
18
+ },
19
+ {
20
+ "type": "TEXT",
21
+ "value": "<p>The Alpha Creation Engine is designed to automate the process of simulating and analyzing Alphas via Python. Here's what's included:</p><ul><li>ace_lib.py - contains main functions that interact with the API.</li><li>helpful_functions.py - provides additional functions. These functions transform outputs into dataframes and load data from the Data Explorer.</li><li>how_to_use.ipynb - Jupyter notebook that demonstrates how to use the `ace_lib.py` and `helpful_functions.py` libraries for alpha simulation and results analysis.</li><li>requirements.txt - lists all the Python modules and their respective versions needed to run our Alpha Creation Engine. This ensures you have the correct environment setup for smooth operation.</li><li>README.md - provides instructions on how to install the required Anaconda package.</li></ul>",
22
+ "id": "54eeb3ba-f746-49f9-b35e-74cf19e84275"
23
+ }
24
+ ],
25
+ "sequence": 31,
26
+ "category": "BRAIN API"
27
+ }