Example #1
0
func main() {
	flag.Parse()

	cfg, err := os.Open(*fixconfig)
	if err != nil {
		log.Fatal(err)
	}

	appSettings, err := quickfix.ParseSettings(cfg)
	if err != nil {
		log.Fatal(err)
	}

	// logFactory, err := quickfix.NewFileLogFactory(appSettings)
	logFactory := quickfix.NewNullLogFactory()
	if err != nil {
		log.Fatal(err)
	}

	storeFactory := quickfix.NewMemoryStoreFactory()

	initiator, err := quickfix.NewInitiator(app, storeFactory, appSettings, logFactory)
	if err != nil {
		log.Fatal(err)
	}
	if err = initiator.Start(); err != nil {
		log.Fatal(err)
	}

	<-start

	for i := 0; i < *sampleSize; i++ {
		order := newordersingle.Builder(
			field.NewClOrdID("100"),
			field.NewHandlInst("1"),
			field.NewSymbol("TSLA"),
			field.NewSide(enum.Side_BUY),
			&field.TransactTimeField{},
			field.NewOrdType(enum.OrdType_MARKET))

		quickfix.SendToTarget(order, SessionID)
		// time.Sleep(1 * time.Millisecond)
	}

	time.Sleep(2 * time.Second)
}
Example #2
0
func queryClOrdID() (*field.ClOrdIDField, error) {
	fmt.Print("ClOrdID: ")
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	return field.NewClOrdID(scanner.Text()), scanner.Err()
}