Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const heatmapStates = {
- type: 'parallel',
- states: {
- idle: {
- on: {
- LOAD_RESIDUES: {
- actions: "cachePair",
- target: ["load_residues", "load_beta_rotation"]
- },
- }
- },
- load_residues: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- onDone: {
- target: 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- load_beta_rotation: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- target: 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- }
- };
- const machineConfig = Machine({
- id: "findpairs",
- context: {
- types: "",
- zscore_cutoff: "",
- vol_beta_rotation: "",
- money_balance: {
- 'min': 0,
- 'max': 0
- },
- favorites_only: "",
- adf_filter: {
- 'adf_99_0': true,
- 'adf_95_0': false,
- 'adf_90_0': false,
- 'periods': false,
- },
- tif: [],
- sectors: []
- },
- initial: "pending_labels",
- states: {
- pending_labels: {
- type: 'parallel',
- states: {
- load_sectors: {
- invoke: {
- src: "requestSectors",
- onDone: {
- target: 'success_sectors',
- actions: "cacheSectors"
- },
- onError: {
- }
- }
- },
- success_sectors: {
- type: 'final'
- },
- cointegration_types: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.cointegration_types': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- favorite_filters: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.favorite_filters': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- strategy_volume: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.strategy_volume': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- strategy_exit: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.strategy_exit': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- strategy_execution: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.strategy_execution': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- tif: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.tif': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- }
- },
- onDone: 'pending_heatmap'
- },
- ready: {
- type: "parallel",
- on: {
- INPUT_TYPES: {
- actions: "cacheTypes",
- },
- INPUT_ZSCORE: {
- actions: "cacheZscore",
- },
- INPUT_VOL_BETA: {
- actions: "cacheMaxVolBeta",
- },
- INPUT_MONEY_BALANCE: {
- actions: "cacheMoneyBalance",
- },
- INPUT_FAV_ONLY: {
- actions: "cacheFavoritesOnly",
- },
- INPUT_ADF_FILTER: {
- actions: "cacheAdfFilter",
- },
- SUBMIT: [
- {
- target: "pending_heatmap"
- },
- ],
- },
- states: {
- heatmap: {
- ...heatmapStates
- },
- }
- },
- pending_heatmap: {
- type: 'parallel',
- states: {
- load_heatmap: {
- type: 'compound',
- initial: 'pending',
- states: {
- pending: {
- on: {
- 'FULFILL.load_heatmap': 'success'
- }
- },
- success: {
- type: 'final'
- }
- }
- },
- },
- onDone: 'ready'
- },
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement