Advertisement
Guest User

Untitled

a guest
Oct 24th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. const heatmapStates = {
  2. type: 'parallel',
  3. states: {
  4. idle: {
  5. on: {
  6. LOAD_RESIDUES: {
  7. actions: "cachePair",
  8. target: ["load_residues", "load_beta_rotation"]
  9. },
  10.  
  11. }
  12. },
  13. load_residues: {
  14. type: 'compound',
  15. initial: 'pending',
  16. states: {
  17. pending: {
  18. onDone: {
  19. target: 'success'
  20. }
  21. },
  22. success: {
  23. type: 'final'
  24. }
  25. }
  26. },
  27. load_beta_rotation: {
  28. type: 'compound',
  29. initial: 'pending',
  30. states: {
  31. pending: {
  32. on: {
  33. target: 'success'
  34. }
  35. },
  36. success: {
  37. type: 'final'
  38. }
  39. }
  40. },
  41. }
  42. };
  43.  
  44. const machineConfig = Machine({
  45. id: "findpairs",
  46. context: {
  47. types: "",
  48. zscore_cutoff: "",
  49. vol_beta_rotation: "",
  50. money_balance: {
  51. 'min': 0,
  52. 'max': 0
  53. },
  54. favorites_only: "",
  55. adf_filter: {
  56. 'adf_99_0': true,
  57. 'adf_95_0': false,
  58. 'adf_90_0': false,
  59. 'periods': false,
  60. },
  61. tif: [],
  62. sectors: []
  63. },
  64. initial: "pending_labels",
  65. states: {
  66. pending_labels: {
  67. type: 'parallel',
  68. states: {
  69. load_sectors: {
  70. invoke: {
  71. src: "requestSectors",
  72. onDone: {
  73. target: 'success_sectors',
  74. actions: "cacheSectors"
  75. },
  76. onError: {
  77.  
  78. }
  79. }
  80. },
  81. success_sectors: {
  82. type: 'final'
  83. },
  84. cointegration_types: {
  85. type: 'compound',
  86. initial: 'pending',
  87. states: {
  88. pending: {
  89. on: {
  90. 'FULFILL.cointegration_types': 'success'
  91. }
  92. },
  93. success: {
  94. type: 'final'
  95. }
  96. }
  97. },
  98. favorite_filters: {
  99. type: 'compound',
  100. initial: 'pending',
  101. states: {
  102. pending: {
  103. on: {
  104. 'FULFILL.favorite_filters': 'success'
  105. }
  106. },
  107. success: {
  108. type: 'final'
  109. }
  110. }
  111. },
  112. strategy_volume: {
  113. type: 'compound',
  114. initial: 'pending',
  115. states: {
  116. pending: {
  117. on: {
  118. 'FULFILL.strategy_volume': 'success'
  119. }
  120. },
  121. success: {
  122. type: 'final'
  123. }
  124. }
  125. },
  126. strategy_exit: {
  127. type: 'compound',
  128. initial: 'pending',
  129. states: {
  130. pending: {
  131. on: {
  132. 'FULFILL.strategy_exit': 'success'
  133. }
  134. },
  135. success: {
  136. type: 'final'
  137. }
  138. }
  139. },
  140. strategy_execution: {
  141. type: 'compound',
  142. initial: 'pending',
  143. states: {
  144. pending: {
  145. on: {
  146. 'FULFILL.strategy_execution': 'success'
  147. }
  148. },
  149. success: {
  150. type: 'final'
  151. }
  152. }
  153. },
  154. tif: {
  155. type: 'compound',
  156. initial: 'pending',
  157. states: {
  158. pending: {
  159. on: {
  160. 'FULFILL.tif': 'success'
  161. }
  162. },
  163. success: {
  164. type: 'final'
  165. }
  166. }
  167. }
  168. },
  169. onDone: 'pending_heatmap'
  170. },
  171. ready: {
  172. type: "parallel",
  173. on: {
  174. INPUT_TYPES: {
  175. actions: "cacheTypes",
  176. },
  177. INPUT_ZSCORE: {
  178. actions: "cacheZscore",
  179. },
  180. INPUT_VOL_BETA: {
  181. actions: "cacheMaxVolBeta",
  182. },
  183. INPUT_MONEY_BALANCE: {
  184. actions: "cacheMoneyBalance",
  185. },
  186. INPUT_FAV_ONLY: {
  187. actions: "cacheFavoritesOnly",
  188. },
  189. INPUT_ADF_FILTER: {
  190. actions: "cacheAdfFilter",
  191. },
  192. SUBMIT: [
  193. {
  194. target: "pending_heatmap"
  195. },
  196. ],
  197. },
  198. states: {
  199. heatmap: {
  200. ...heatmapStates
  201. },
  202. }
  203. },
  204. pending_heatmap: {
  205. type: 'parallel',
  206. states: {
  207. load_heatmap: {
  208. type: 'compound',
  209. initial: 'pending',
  210. states: {
  211. pending: {
  212. on: {
  213. 'FULFILL.load_heatmap': 'success'
  214. }
  215. },
  216. success: {
  217. type: 'final'
  218. }
  219. }
  220. },
  221. },
  222. onDone: 'ready'
  223. },
  224. }
  225. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement