database

package
v0.0.0-...-9e6d8ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 2 Imported by: 9

Documentation

Index

Constants

View Source
const (
	//UserLevelAdministrator -
	UserLevelAdministrator = iota
	//UserLevelNormal -
	UserLevelNormal
)

Variables

View Source
var AssetsList map[string]Assets = map[string]Assets{
	"eurusd":    Assets{ID: "eurusd", Sort: 1, Type: "forex", Name: "EUR/USD"},
	"usdjpy":    Assets{ID: "usdjpy", Sort: 2, Type: "forex", Name: "USD/JPY"},
	"audusd":    Assets{ID: "audusd", Sort: 3, Type: "forex", Name: "AUD/USD"},
	"gbpusd":    Assets{ID: "gbpusd", Sort: 4, Type: "forex", Name: "GBP/USD"},
	"usdchf":    Assets{ID: "usdchf", Sort: 5, Type: "forex", Name: "USD/CHF"},
	"audjpy":    Assets{ID: "audjpy", Sort: 6, Type: "forex", Name: "AUD/JPY"},
	"usdcad":    Assets{ID: "usdcad", Sort: 7, Type: "forex", Name: "USD/CAD"},
	"eurgbp":    Assets{ID: "eurgbp", Sort: 8, Type: "forex", Name: "EUR/GBP"},
	"eurjpy":    Assets{ID: "eurjpy", Sort: 9, Type: "forex", Name: "EUR/JPY"},
	"euraud":    Assets{ID: "euraud", Sort: 10, Type: "forex", Name: "EUR/AUD"},
	"gbpjpy":    Assets{ID: "gbpjpy", Sort: 11, Type: "forex", Name: "GBP/JPY"},
	"eurzar":    Assets{ID: "eurzar", Sort: 12, Type: "forex", Name: "EUR/ZAR"},
	"eurcad":    Assets{ID: "eurcad", Sort: 13, Type: "forex", Name: "EUR/CAD"},
	"nzdusd":    Assets{ID: "nzdusd", Sort: 14, Type: "forex", Name: "NZD/USD"},
	"eurnzd":    Assets{ID: "eurnzd", Sort: 15, Type: "forex", Name: "EUR/NZD"},
	"gbpcad":    Assets{ID: "gbpcad", Sort: 16, Type: "forex", Name: "GBP/CAD"},
	"cadchf":    Assets{ID: "cadchf", Sort: 17, Type: "forex", Name: "CAD/CHF"},
	"cadjpy":    Assets{ID: "cadjpy", Sort: 18, Type: "forex", Name: "CAD/JPY"},
	"audcad":    Assets{ID: "audcad", Sort: 19, Type: "forex", Name: "AUD/CAD"},
	"eurchf":    Assets{ID: "eurchf", Sort: 20, Type: "forex", Name: "EUR/CHF"},
	"nzdjpy":    Assets{ID: "nzdjpy", Sort: 21, Type: "forex", Name: "NZD/JPY"},
	"chfjpy":    Assets{ID: "chfjpy", Sort: 22, Type: "forex", Name: "CHF/JPY"},
	"usdmxn":    Assets{ID: "usdmxn", Sort: 23, Type: "forex", Name: "USD/MXN"},
	"eurmxn":    Assets{ID: "eurmxn", Sort: 24, Type: "forex", Name: "EUR/MXN"},
	"usdrub":    Assets{ID: "usdrub", Sort: 25, Type: "forex", Name: "USD/RUB"},
	"audnzd":    Assets{ID: "audnzd", Sort: 26, Type: "forex", Name: "AUD/NZD"},
	"audchf":    Assets{ID: "audchf", Sort: 27, Type: "forex", Name: "AUD/CHF"},
	"nzdcad":    Assets{ID: "nzdcad", Sort: 28, Type: "forex", Name: "NZD/CAD"},
	"usdsek":    Assets{ID: "usdsek", Sort: 29, Type: "forex", Name: "USD/SEK"},
	"audsek":    Assets{ID: "audsek", Sort: 30, Type: "forex", Name: "AUD/SEK"},
	"usdnok":    Assets{ID: "usdnok", Sort: 31, Type: "forex", Name: "USD/NOK"},
	"chfnok":    Assets{ID: "chfnok", Sort: 32, Type: "forex", Name: "CHF/NOK"},
	"usdhuf":    Assets{ID: "usdhuf", Sort: 33, Type: "forex", Name: "USD/HUF"},
	"sekjpy":    Assets{ID: "sekjpy", Sort: 34, Type: "forex", Name: "SEK/JPY"},
	"nzdchf":    Assets{ID: "nzdchf", Sort: 35, Type: "forex", Name: "NZD/CHF"},
	"usdpln":    Assets{ID: "usdpln", Sort: 36, Type: "forex", Name: "USD/PLN"},
	"eurnok":    Assets{ID: "eurnok", Sort: 37, Type: "forex", Name: "EUR/NOK"},
	"noksek":    Assets{ID: "noksek", Sort: 38, Type: "forex", Name: "NOK/SEK"},
	"usddkk":    Assets{ID: "usddkk", Sort: 39, Type: "forex", Name: "USD/DKK"},
	"nokjpy":    Assets{ID: "nokjpy", Sort: 40, Type: "forex", Name: "NOK/JPY"},
	"usdczk":    Assets{ID: "usdczk", Sort: 41, Type: "forex", Name: "USD/CZK"},
	"eursgd":    Assets{ID: "eursgd", Sort: 42, Type: "forex", Name: "EUR/SGD"},
	"sgdjpy":    Assets{ID: "sgdjpy", Sort: 43, Type: "forex", Name: "SGD/JPY"},
	"audsgd":    Assets{ID: "audsgd", Sort: 44, Type: "forex", Name: "AUD/SGD"},
	"chfsgd":    Assets{ID: "chfsgd", Sort: 45, Type: "forex", Name: "CHF/SGD"},
	"audnok":    Assets{ID: "audnok", Sort: 46, Type: "forex", Name: "AUD/NOK"},
	"cadpln":    Assets{ID: "cadpln", Sort: 47, Type: "forex", Name: "CAD/PLN"},
	"eurdkk":    Assets{ID: "eurdkk", Sort: 48, Type: "forex", Name: "EUR/DKK"},
	"cadnok":    Assets{ID: "cadnok", Sort: 49, Type: "forex", Name: "CAD/NOK"},
	"nzdsgd":    Assets{ID: "nzdsgd", Sort: 50, Type: "forex", Name: "NZD/SGD"},
	"gold":      Assets{ID: "gold", Sort: 51, Type: "commodities", Name: "Gold"},
	"silver":    Assets{ID: "silver", Sort: 52, Type: "commodities", Name: "Silver"},
	"platinum":  Assets{ID: "platinum", Sort: 53, Type: "commodities", Name: "Platinum"},
	"usdjpyotc": Assets{ID: "usdjpyotc", Sort: 54, Type: "forexotc", Name: "USD/JPY (OTC)"},
	"usdchfotc": Assets{ID: "usdchfotc", Sort: 55, Type: "forexotc", Name: "USD/CHF (OTC)"},
	"nzdusdotc": Assets{ID: "nzdusdotc", Sort: 56, Type: "forexotc", Name: "NZD/USD (OTC)"},
	"gbpusdotc": Assets{ID: "gbpusdotc", Sort: 57, Type: "forexotc", Name: "GBP/USD (OTC)"},
	"gbpjpyotc": Assets{ID: "gbpjpyotc", Sort: 58, Type: "forexotc", Name: "GBP/JPY (OTC)"},
	"eurusdotc": Assets{ID: "eurusdotc", Sort: 59, Type: "forexotc", Name: "EUR/USD (OTC)"},
	"eurjpyotc": Assets{ID: "eurjpyotc", Sort: 60, Type: "forexotc", Name: "EUR/JPY (OTC)"},
	"eurgbpotc": Assets{ID: "eurgbpotc", Sort: 61, Type: "forexotc", Name: "EUR/GBP (OTC)"},
	"audcadotc": Assets{ID: "audcadotc", Sort: 62, Type: "forexotc", Name: "AUD/CAD (OTC)"},
	"usdsgdotc": Assets{ID: "usdsgdotc", Sort: 63, Type: "forexotc", Name: "USD/SGD (OTC)"},
	"usdhkdotc": Assets{ID: "usdhkdotc", Sort: 64, Type: "forexotc", Name: "USD/HKD (OTC)"},
	"usdinrotc": Assets{ID: "usdinrotc", Sort: 65, Type: "forexotc", Name: "USD/INR (OTC)"},
}

AssetsList -

Functions

func GetProxyName

func GetProxyName(pr ProxyType) (sc string)

GetProxyName -

Types

type AssetProvider

type AssetProvider struct {
	ID       string `json:"id" required:"id is required" validate:"required,min=4"`
	Provider string `json:"provider" required:"provider is required" validate:"required,min=4"`
}

AssetProvider -

type Assets

type Assets struct {
	ProviderID        string          `json:"providerId"`
	ID                string          `json:"id"`
	Sort              int             `json:"sort"`
	Type              string          `json:"type"`
	Name              string          `json:"name"`
	Active            bool            `json:"active"`
	Proxy             string          `json:"proxy"`
	AvailableProvider []RatesProvider `json:"availableProvider"`
}

Assets -

type BrokersProvider

type BrokersProvider struct {
	SortID  int                   `json:"sortID"`
	ID      string                `json:"id"`
	Name    string                `json:"name"`
	Details string                `json:"details"`
	Config  BrokersProviderConfig `json:"config"`
}

BrokersProvider -

type BrokersProviderConfig

type BrokersProviderConfig struct {
	ID     string `json:"id" required:"id is required" validate:"required,min=4"`
	Host   string `json:"host" fqdn:"not valid Full Qualified Domain Name (FQDN)" validate:"fqdn"`
	Active bool   `json:"active"`
}

BrokersProviderConfig -

type KeyPair

type KeyPair struct {
	Private string `json:"private"`
	Public  string `json:"public"`
}

KeyPair -

type ProviderConfig

type ProviderConfig struct {
	ID                     string `json:"id" required:"id is required" validate:"required,min=4"`
	Email                  string `json:"email" required:"email is required" email:"email not valid" validate:"required,email"`
	Password               string `json:"password" required:"password is required" min:"min password is 4 char" validate:"required,min=4"`
	APIKey                 string `json:"apiKey" required:"apiKey is required" min:"min password is 4 char" validate:"required,min=4"`
	Host                   string `json:"host" fqdn:"not valid Full Qualified Domain Name (FQDN)" validate:"fqdn"`
	Proxy                  string `json:"proxy"`
	EnableProxy            bool   `json:"enableProxy"`
	EnableActiveAssetsOnly bool   `json:"enableActiveAssetsOnly"`
	EncryptionKey          string `json:"encryptionKey" len:"encryptionKey must be 32 char" validate:"len=32"`
	UserAgent              string `json:"userAgent" required:"userAgent is required" min:"min userAgent is 4 char" validate:"required,min=4"`
	Active                 bool   `json:"active"`
}

ProviderConfig -

type Proxy

type Proxy struct {
	ID        string               `json:"id"`
	UserID    string               `json:"userId"`
	ProxyType ProxyType            `json:"proxyType"`
	Name      string               `json:"name"`
	Address   string               `json:"address"`
	Port      int                  `json:"port"`
	Username  string               `json:"username"`
	Password  string               `json:"password"`
	UseAuth   bool                 `json:"useAuth"`
	Created   time.Time            `json:"created"`
	Updated   time.Time            `json:"updated"`
	UsedBy    map[string]ProxyUsed `json:"usedBy"`
}

Proxy -

type ProxyType

type ProxyType int

ProxyType -

const (
	//ProxyTypeSocks5 -
	ProxyTypeSocks5 ProxyType = iota + 1
)

type ProxyUsed

type ProxyUsed struct {
	UsedType   ProxyUsedType `json:"proxyUsedType"`
	ID         string        `json:"id"`
	ProviderID string        `json:"providerID"`
}

ProxyUsed -

type ProxyUsedType

type ProxyUsedType int

ProxyUsedType -

const (
	//ProxyUsedTypeRates -
	ProxyUsedTypeRates ProxyUsedType = iota + 1
	//ProxyUsedTypeRatesAssets -
	ProxyUsedTypeRatesAssets
	//ProxyUsedTypeBrokers -
	ProxyUsedTypeBrokers
	//ProxyUsedTypeBrokersAccounts -
	ProxyUsedTypeBrokersAccounts
	//ProxyUsedTypeBrokersAccountsTasks -
	ProxyUsedTypeBrokersAccountsTasks
)

type PublicKey

type PublicKey struct {
	DeviceID  string `json:"deviceId"`
	PublicKey string `json:"publicKey"`
}

PublicKey -

type RatesProvider

type RatesProvider struct {
	SortID  int            `json:"sortID"`
	ID      string         `json:"id"`
	Name    string         `json:"name"`
	Details string         `json:"details"`
	Assets  []Assets       `json:"assets"`
	Config  ProviderConfig `json:"config"`
}

RatesProvider -

type Stores

type Stores struct {
	Email          sync.Map
	Users          sync.Map
	Sessions       sync.Map
	PublicKey      sync.Map
	Token          sync.Map
	AssetsProvider sync.Map
	Proxy          sync.Map
}

Stores -

type Token

type Token struct {
	SessionID string `json:"sessionId"`
	Token     string `json:"token"`
	Created   int64  `json:"created"`
	LastUsed  int64  `json:"lastUsed"`
	ID        string `json:"id"`
}

Token -

type Users

type Users struct {
	Default   bool   `json:"default"`
	ID        string `json:"id"`
	Name      string `json:"name"`
	Email     string `json:"email"`
	Password  string `json:"password"`
	UserLevel int    `json:"userlevel"`
}

Users -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL