Guest User

Untitled

a guest
Jan 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. # OptionsGo File Format (version 1)
  2.  
  3. OptionsGo file (`.txt` extension) is a plain text file (unicode or UTF-8 encoding) that uses line-based syntax. Each line can be only one of these but they can be in any order:
  4.  
  5. 1. Command lines
  6. 1. Order lines
  7. 1. Text lines
  8. 1. Comment lines
  9.  
  10. ## 1. Command Lines
  11. Command line begins with `@` sign immediately followed by command name, a whitespace, and value.
  12.  
  13. ```
  14. @command value
  15. ```
  16.  
  17. Command | Description | Sample
  18. -------- | ----------- | -------
  19. @version | Version of OptionsGo parser | @version 0.1
  20. @owner | Owner of the diary | @owner Thep
  21. @title | Portfolio title | @title Paper Trade
  22. @series | Series of the future | @series S50H19
  23. @index | Index | @index 1053.2
  24. @comm | Commission rate (Baht per contract) | @comm 80
  25. @date | Full date | @date 3 Jan 2019
  26. @time | 24-hour time | @time 14:45
  27. @year | Year | @year 2019
  28. @month | Month | @month 1
  29. @day | Day | @day 3
  30. @group | Start a new group | @group Cashflow
  31. @. | Shorthand for @group | @. Cashflow
  32. @ref | Order reference | @ref dog-01
  33. @# | Short for @ref | @# dog-01
  34.  
  35. ### Tagged command
  36.  
  37. #### Using `.group` Tag
  38. ```
  39. @group A
  40. LF @1017 x 1
  41. ```
  42. is equivalant to
  43. ```
  44. LF @1017 x 1 .A
  45. ```
  46.  
  47. #### Using `#ref` Tag
  48. ```
  49. @ref dog1
  50. LF @1017 x 1
  51. ```
  52. is equivalent to
  53. ```
  54. LF @1017 x 1 #dog1
  55. ```
  56.  
  57. #### Mixed Tags
  58. ```
  59. -- this order is in group A and has ref dog1
  60. LF @1017 x 1 .A #dog1
  61. ```
  62.  
  63. #### Nested Tags
  64.  
  65. Nested groups.
  66.  
  67. ```
  68. -- no @group above this line.
  69. -- so the default group is "" (empty text).
  70. LF @1000 x 1 .A -- is in group "A"
  71.  
  72. @group B
  73. LF @1706 x 2 -- in group "B"
  74. LF @1707 x 2 .L -- in group "A.L"
  75.  
  76. @group C
  77. LF @1708 x 2 -- in group "B"
  78.  
  79. -- this line will be ignored.
  80. @group .D -- . notation is not allowed here
  81.  
  82. @group -- set group to default empty group again
  83. LF @1000 x 2 .E -- in group "E"
  84.  
  85. -- you can use @. instead of @group all the time
  86. ```
  87.  
  88. Using #ref in the @group line
  89.  
  90. ```
  91. @group A #cat-1
  92. LC 1025 @25 x 2 -- ref is "cat-1"
  93. LC 1050 @11 x 2 #a -- ref is "cat-1.a"
  94. ```
  95.  
  96. Nested refs.
  97.  
  98. ```
  99. -- no @ref above this line
  100. LF @1000 x 1 #dog1 -- ref is "dog1"
  101.  
  102. @ref dog2
  103. LF @1000 x 1 -- ref is "dog2"
  104. SF @1010 x 1 #TP -- ref is "dog2.TP"
  105.  
  106. @ref dog3
  107. LF @1000 x 1 -- ref is "dog3"
  108.  
  109. -- this line will be ignored.
  110. @ref #dog4 -- # notation is not allowed here
  111.  
  112. @ref -- set ref to default empty ref again
  113. LF @1000 x 1 #TP -- ref is "TP"
  114. ```
  115.  
  116. Refs are cleared when start a new group.
  117. ```
  118. @group G1
  119. @ref X
  120. LF @1000 x 1 -- ref is X
  121. LF @1001 x 1 #a -- ref is X.a
  122.  
  123. @group G2 -- new group will clear the refs.
  124. LF @1002 x 1 #b -- ref is b, not X.b!
  125. ```
  126.  
  127. #### Order Id
  128. Every order has a uniqued id as a running number start with 1.
  129.  
  130.  
  131. ### Command Effectives
  132. All commands are effected from that line downward. For example:
  133.  
  134. ```
  135. @year 2019
  136. @month Jan
  137. @day 5
  138. LF @1055.2 x 2 -- order is belong to 5 Jan, 2019
  139.  
  140. @day 6
  141. SF @1066.0 x 1 -- order is belong to 6 Jan, 2019
  142.  
  143. @date Feb 1, 2019
  144. SF @1000 x 1 -- order is belong to 1 Feb, 2019
  145.  
  146. @day 2
  147. SF @1000 x 1 -- order is belong to 2 Feb, 2019
  148. ```
  149.  
  150.  
  151. ## 2. Order Lines
  152. ```
  153. [order_status] order_action order_detail
  154. ```
  155.  
  156. ### Order Status
  157. Order status is a single character that is optional. If you has this, you must separate it from the order_action with a space.
  158.  
  159. Status | Description |
  160. :----: | ------ |
  161. o | Enabled order. *This is the default status*.
  162. x | Disabled order. This order was not happened and not included in payoff chart.
  163. | - | Planed order. This order is planed to take action in the future.
  164.  
  165. ### Order Actions
  166.  
  167. Action | Description
  168. :----: | --
  169. LF | Long future
  170. SF | Short future
  171. LC | Long call
  172. LP | Long put
  173. SC | Short call
  174. SP | Short put
  175.  
  176.  
  177. ## 3. Text Lines
  178. ```
  179. any other are free text. Can be either ภาษาไทย หรือ English or even emoji ⚔️.
  180.  
  181. you can make paragraph with a blank line.
  182. This is the second line of the paragraph.
  183. becareful that not begin the line with order prefix.
  184. ```
  185.  
  186. ## 4. Comments
  187. Comment starts with two dashes (--). Comment text is just a note for yourself and will not be considered as command, order, or text. We have two type of comments, full line comment.
  188. ```
  189. -- line comments
  190. ```
  191. and comment to the end-of-line.
  192. ```
  193. @title Hello -- end of line comment
  194. ```
Add Comment
Please, Sign In to add comment