Ejemplo n.º 1
0
//Execute an BalancesCommand
func (command *BalancesCommand) Execute() (err error) {
	log.Debug("Executing BalancesCommand Command")

	c, err := poloniexclient.NewClient(command.Credentials.Key, command.Credentials.Secret)
	if err != nil {
		return
	}

	balances, err := c.ReturnBalances()
	if err != nil {
		return
	}
	log.Debug(balances)
	if command.Format == FormatAsJSON {
		err = formatAsJSON(balances)
	} else {
		err = formatBalancesAsTable(balances)
	}
	return
}
Ejemplo n.º 2
0
//Execute an OrderBookCommand
func (command *OrderBookCommand) Execute() (err error) {
	log.Debug("Executing OrderBook Command:\n\tCurrency pair: ", command.CurrencyPair, "\n\tDepth: ", command.Depth)

	c, err := poloniexclient.NewClient("", "")
	if err != nil {
		return
	}

	orderbook, err := c.ReturnOrderBook(command.CurrencyPair, command.Depth)
	if err != nil {
		return
	}
	log.Debug(orderbook)
	if command.Format == FormatAsJSON {
		err = formatAsJSON(orderbook)
	} else {
		err = formatOrderBookAsTable(orderbook)
	}
	return
}
Ejemplo n.º 3
0
//Execute a LoanOrdersCommand
func (command *LoanOrdersCommand) Execute() (err error) {
	log.Debug("Executing LoanOrders Command:\n\tCurrency: ", command.Currency)

	c, err := poloniexclient.NewClient("", "")
	if err != nil {
		return
	}

	loanorders, err := c.ReturnLoanOrders(command.Currency)
	if err != nil {
		return
	}
	log.Debug(loanorders)
	if command.Format == FormatAsJSON {
		err = formatAsJSON(loanorders)
	} else {
		err = formatLoanOrdersAsTable(loanorders)
	}
	return
}