Documentation ¶
Overview ¶
This package is for connecting to a local instance of PostgreSQL while acquiring FOREX data from Oanda.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectPSQL ¶
func ConnectPSQL(ctx context.Context, user string, password string, dbname string, sslmode string) (*pgxpool.Pool, error)
Connect to local instance of PostgreSQL.
Requires username, password, database name, and if ssl mode should use encryption or not ("enable" or "disable")
func GetStreamPSQL ¶
func GetStreamPSQL(ctx context.Context, conn *pgxpool.Pool, password string, instrument string, token string, id string, display bool)
Get JSON Stream for Pricing endpoint - returns live Bid/Ask.
- Parameters requires list of instruments, token, and id
func ImportPassword_ ¶
func ImportPassword_() string
Be careful not to expose your password to the public modify password_edit.go file found in connect directory rename that file password.go and this file only has one function. This functions name needs to be edited by removing the underscore at the end of 'ImportPassword_' function. modify the return statement for the password of your PostgreSQL user that is accessing your local instance
Types ¶
type HeartBeat ¶
struct for unmarshalling json data from Oanda's Pricing - stream endpoint.
Note: every 5 seconds a 'heartbeat' is sent from this endpoint to let you know the connection is still alive.
type Stream ¶
type Stream struct { Type string `json:"type"` Time string `json:"time"` Bids [1]struct { Price string `json:"price"` Liquidity int64 `json:"liquidity"` } `json:"bids"` Asks [1]struct { Price string `json:"price"` Liquidity int64 `json:"liquidity"` } `json:"asks"` CloseOutBid string `json:"closeoutbid"` CloseOutAsk string `json:"closeoutask"` Status string `json:"status"` Tradeable bool `json:"tradeable"` Instrument string `json:"instrument"` }
struct for unmarshalling json data from Oanda's Pricing - stream endpoint.