Skip to content

Instantly share code, notes, and snippets.

@WJWang
Created April 25, 2021 19:43
Show Gist options
  • Save WJWang/a44f70d17bb94845bbc700a760e59591 to your computer and use it in GitHub Desktop.
Save WJWang/a44f70d17bb94845bbc700a760e59591 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const spotFutureCreate = Machine({
id: '建立部位',
initial: '現貨數 < 設定目標數',
states: {
'現貨數 < 設定目標數': {
on: {
'買現貨': '期貨空單數 < 現貨數',
},
},
'期貨空單數 < 現貨數': {
on: {
'空期貨': '期貨空單數 = 現貨數',
},
},
'期貨空單數 = 現貨數': {
on: {
'未達設定目標數': '現貨數 < 設定目標數',
'已達設定目標數': '結束建立部位',
},
},
'結束建立部位': { type: 'final' },
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment