Skip to content

Instantly share code, notes, and snippets.

@surrealist
Last active April 4, 2019 16:39
Show Gist options
  • Select an option

  • Save surrealist/6e578b2c1362cd1be1feb28ac212747b to your computer and use it in GitHub Desktop.

Select an option

Save surrealist/6e578b2c1362cd1be1feb28ac212747b to your computer and use it in GitHub Desktop.
https://OptionsGo.net data text format

OptionsGo Data Text Format (version 0.1)

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:

  1. Command lines
  2. Order lines
  3. Text lines
  4. Comment lines

1. Command Lines

Command line begins with @ sign immediately followed by command name, a whitespace, and value.

@command value
Command Description Sample
@version Version of OptionsGo parser @version 0.1
@owner or @by or @author Owner @by Thep
@title Portfolio title @title Paper Trade
@series Series of the future @series S50H19
@comm Commission rate (Baht per contract) @comm 80
@date Full date @date 3 Jan 2019
@time 24-hour time @time 14:45
@year Year @year 2019
@month Month @month 1
@day Day @day 3
@index Index @index 1053.2
@^ Shorthand for @index @^ 1055.5
@group Start a new group @group Cashflow
@. Shorthand for @group @. Cashflow
@ref Order reference name @ref dog-01
@# Short for @ref @# dog-01

Tagged command

Using .group Tag

@group A
LF @1017 x 1 

is equivalant to

LF @1017 x 1 .A

Using #ref Tag

@ref dog-01
LF @1017 x 1

is equivalent to

LF @1017 x 1 #dog-01

Using ^index Tag

@index 1055.5
LC 1075 @14 x 2

is equivalent to

LC 1075 @14 x 2 ^1055.5

Mixed Tags

-- this order is in group A 
-- and has reference name as dog1
-- and ordered at index 1055.5
LC 1075 @14 x 1 .A #dog1 ^1055.5

Nested Tags

Nested groups.

-- no @group above this line. 
-- so the default group is "" (empty text).
LF @1000 x 1 .A -- is in group "A"

@group B
LF @1706 x 2 -- in group "B"
LF @1707 x 2 .L -- in group "B.L"

@group C
LF @1708 x 2 -- in group "C"

-- this line will be ignored.
@group .D    -- . notation is not allowed here

@group -- reset group to default empty group again
LF @1000 x 2 .E -- in group "E"

-- you can use @. instead of @group all the time

Using #ref in the @group line

@group A #cat-1
LC 1025 @25 x 2    -- ref is "cat-1"
LC 1050 @11 x 2 #a -- ref is "cat-1.a"

Nested refs.

-- no @ref above this line
LF @1000 x 1 #dog1 -- ref is "dog1"

@ref dog2
LF @1000 x 1 -- ref is "dog2"
SF @1010 x 1 #TP -- ref is "dog2.TP"

@ref dog3
LF @1000 x 1 -- ref is "dog3"

-- this line will be ignored.
@ref #dog4   -- # notation is not allowed here

@ref -- reset ref to default empty ref again
LF @1000 x 1 #TP -- ref is "TP"

A single reference names can be use for multiple orders (Can be duplicated). References will be cleared when start a new group.

@group G1
@ref X
LF @1000 x 1    -- ref is X
LF @1001 x 1 #a -- ref is X.a

@group G2       -- starts new group, this will clear the refs.
LF @1002 x 1 #b -- ref is b, not X.b!

Order Id

Every order has a uniqued id as a running number start with 1.

Command Effectives

All commands are effected from that line downward. For example:

@year 2019
@month Jan
@day 5
LF @1055.2 x 2  -- order is belong to 5 Jan, 2019

@day 6
SF @1066.0 x 1  -- order is belong to 6 Jan, 2019

@date Feb 1, 2019
SF @1000 x 1    -- order is belong to 1 Feb, 2019

@day 2
SF @1000 x 1    -- order is belong to 2 Feb, 2019

2. Order Lines

[order_status] order_action order_detail

Order Status

Order status is a single character that is optional. If you has this, you must separate it from the order_action with a space.

Status Description
o Enabled order. This is the default status.
x Disabled order. This order was not happened and not included in payoff chart.
- Planned order. This order is planed to take action in the future.

Order Actions

Action Description
LF Long future
SF Short future
LC Long call
LP Long put
SC Short call
SP Short put

3. Text Lines

Text will be displayed in Orders Tab.

any other are free text. Can be either ภาษาไทย or English or even emojis 🐄💨.

you can make a paragraph by a blank line.
This is the second line of the paragraph.
becareful that not begin the line with order prefix. 

Text Line Command

Uses @text or @: as a line prefix to make that line interprets as a text, not an order.

@text LC me please!

or

@: LC, SP, and LF are your upward weapons.

4. Comments

Comment starts with two dashes (--). Comment text is just a note for yourself and will not be considered as command, order, or text. Comments will not be displayed in Orders Tab. We have two type of comments.

This is a full line comment.

-- line comments

and this is an end-of-line comment.

@title Hello -- end of line comment

This is a text line, not a comment line.

- Don't forget to buy the milk.

This can be a comment line.

-------------
-- Comment --
------------- 

Sample

@by YourName
@title Portfolio
@series S50H19
@date 20 Jan 2019

@group Today
@index 1050

SF @1055.0 x 1
LC 1050 @25.0 x 1

Text Tab

image

Orders Tab

image

@surrealist
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment