$ go get github.com/z-Wind/stock
$ cd $GOPATH/src/github.com/z-Wind/stock
// Create instance folder
$ mkdir instance
$ mv secretConfig.go.sample ./instance/secretConfig.go
$ mv client_secret.json.sample ./instance/client_secret.json
$ cd instance
// fill out secretConfig.go & client_secret.json for AlphaVangtage & TD
$ vim secretConfig.go
// client_secret does not need to fill
$ vim client_secret.json
// create ssl
$ openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
$ cd $GOPATH/src/github.com/z-Wind/stock
$ make build
$ go build
$ cd $GOPATH/src/github.com/z-Wind/stock
$ make test
$ cd $GOPATH/src/github.com/z-Wind/stock
$ make clean
$ stock -addr host:port [-accountID id]
$ GET http://localhost:6060/quote?symbols={symbols}
- symbols: seperate by comma,like VTI,VBR
$ GET http://localhost:6060/priceHistory?symbols={symbols}
- symbols: seperate by comma,like VTI,VBR
$ GET http://localhost:6060/priceAdjHistory?symbols={symbols}
- symbols: seperate by comma,like VTI,VBR
just for TD Ameritrade, should set accountID
$ GET http://localhost:6060/savedOrder
$ DELETE http://localhost:6060/savedOrder?savedOrderID={savedOrderID}
$ POST JSON http://localhost:6060/savedOrder
JSON Format
{
"Symbol": "string",
"AssetType": "string[1]",
"Instruction": "string[1]",
"Price": 0,
"Qunatity": 0
}
$ cd $GOPATH/src/github.com/z-Wind/stock
$ ./stock -addr localhost:6060
go to http://localhost:6060/
$ curl -X GET http://localhost:6060/quote?symbols=VTI,VBR,0050.tw,6564.two
$ curl -X GET http://localhost:6060/priceHistory?symbols=VTI,VBR,0050.tw,6564.two
$ curl -X GET http://localhost:6060/priceAdjHistory?symbols=VTI,VBR,0050.tw,6564.two
for just TD Ameritrade, should set accountID
$ curl -X GET http://localhost:6060/savedOrder