func main() {
	flag.Parse()
	if *confFile == "" {
		log.Fatal("You must specify a json configuration file (-conf=CONF_FILE)")
	}
	file, err := os.Open(*confFile)
	checkErr(err)
	defer file.Close()

	dec := json.NewDecoder(file)
	config := new(betfair.Config)
	dec.Decode(&config)

	s, err := betfair.NewSession(config)
	checkErr(err)

	loginErr := s.LoginNonInteractive()
	checkErr(loginErr)
	defer s.Logout()

	s.Live = true

	filter := new(betfair.MarketFilter)
	filter.EventTypeIds = []string{"1"}
	filter.MarketCountries = []string{"GB"}

	events, err := s.ListEvents(filter)
	checkErr(err)

	for _, event := range events {
		fmt.Printf("%s: [%s] %s (%d markets)\n", event.Event.OpenDate, event.Event.CountryCode, event.Event.Name, event.MarketCount)
	}
}
Exemple #2
0
func main() {
	flag.Parse()
	if *confFile == "" {
		log.Fatal("You must specify a json configuration file (-conf=CONF_FILE)")
	}
	file, err := os.Open(*confFile)
	checkErr(err)
	defer file.Close()

	dec := json.NewDecoder(file)
	config := new(betfair.Config)
	dec.Decode(&config)

	s, err := betfair.NewSession(config)
	checkErr(err)

	loginErr := s.LoginNonInteractive()
	checkErr(loginErr)
	defer s.Logout()

	details, err := s.GetAccountDetails()
	checkErr(err)

	funds, err := s.GetAccountFunds()
	checkErr(err)

	fmt.Printf("%s %s (%s)\n", details.FirstName, details.LastName, details.LocaleCode)
	fmt.Printf("\tAvailable: %s %.2f\n", details.CurrencyCode, funds.AvailableToBetBalance)
	fmt.Printf("\tExposure : %s %.2f\n", details.CurrencyCode, funds.Exposure)
}