TwitterGoogleRSS

Git – “chmod” on Windows

Git works on almost all platforms flawlessly. But because Git take it’s heritage from the Linux community things like file permissions work a little differently then Windows users would expect. In my specific situation I’m pushing a Git repository to Openshift. When the build runs on the git repository I receive the following error.

"../go/bin/go: Permission denied".

This is caused by the go binary (which is checked into my git repository) not having “execute” permissions on the Linux machine. Normally a Linux user would run “chmod +x <filename>” to add execute permissions and then commit/push the updated file to git. On Windows we don’t have chmod but we can update the file permissions directly within Git.

git update-index --chmod=+x <filename>

Then commit/push the Git repository as normal and the file permissions should be updated for all pull requests thereafter.

Be Sociable, Share!

Go – Openshift

There are a few options for running Go on the web. Google app engine is a popular option for running Go services but an up and coming option is Openshift. Although Go cannot be run on Openshift using the simple online wizards they do offer a DIY solution. github.com/gcmurphy/golang-openshift has a very easy to use base for creation your own go applications.

Be Sociable, Share!

Markdown – Adding CSS to your HTML file

Markdown is very easy to write both by users or any scripting/programming languages. I describe how markdown can be written in my post “Go – Writing markdown“. If you choose to display markdown to users online you may wish to make the page look a little more snazzy. A simple way of doing this is generating a HTML file and adding a CSS file to “theme” your page.

The HTML will require a CSS theme added in the tags. In this example I will borrow a theme from github.com/jasonm23/markdown-css-themes.

<html>
<head>
<link rel="stylesheet" type="text/css" href="https://raw.github.com/jasonm23/markdown-css-themes/gh-pages/markdown1.css">
</head>

Then we need to add the tags containing the generated HTML file and the closing tag.

<body>

<!--This page was created with Markdown-->
<!--Start of generated html-->
<h1>Email Brief</h1>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Get Gmail on your mobile phone</h3>

<p>[image: Access Gmail on your mobile phone]
<a href="http://www.google.com/xxxyyy">http://www.google.com/xxxyyy</a></p>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Import your contacts and old email</h3>

<p>You can import your contacts and mail from Yahoo!, Hotmail, AOL, and many
other web mail or POP accounts. If you want, we'll even keep importing your
mail for the next 30 days.
 Import contacts and mail
=BB<a href="https://mail.google.com/mail/#settings/accounts">https://mail.google.com/mail/#settings/accounts</a></p>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Customize Gmail with colors and themes</h3>

<p>To spice up your inbox with colors and themes, check out the Themes tab
under Settings.
 Customize Gmail =BB <a href="https://mail.google.com/mail/#settings/themes">https://mail.google.com/mail/#settings/themes</a></p>

<h2>Google+ team &lt;noreply@plus.google.com&gt;</h2>

<h3>Getting started on Google+</h3>

<p>Hey,Welcome to Google+ - we're glad you're here! Here's a video and<br/>
some tips to help you get started:</p>
<!--End of generated html-->

</body>
</html>

This is a very simple theme but looks much nicer then the default unstyled HTML.

Markdown To HTML Displaying Preview Of Emails

Be Sociable, Share!

Go – Writing markdown

In my post “Go – Writing a simple email client” I described some quick Go code to download your Gmail content through IMAP. In this post I’ll extend the email client to generate markdown. Then I will describe how this content can be converted into html.

Lets say we want to print an overview of the email content in our INBOX. We will require the “Name” and “Address” where the email came from. We will also require a quick snippet of the email. Here is what the extra code might look liked.

	fresp, err := im.Fetch("1:*", []string{"RFC822", "Envelope"})
	if err != nil {
		fmt.Print("Fetch failed\n")
		os.Exit(1)
	}

	fmt.Println("Email Brief")
	fmt.Println("===========\n")
	for _, fr := range fresp {
		fmt.Println(fr.Envelope.From[0].Name + " \\<" + string(fr.Envelope.From[0].Address) + "\\>")
		fmt.Println(strings.Repeat("-", 5+len(fr.Envelope.From[0].Name)+len(fr.Envelope.From[0].Address)))

		fmt.Println("###" + *fr.Envelope.Subject + "###")

		fmt.Println(strings.Split(string(fr.Rfc822), "\r\n\r\n")[2] + "\n")
	}
}

In my case I’m testing this with a new Gmail account and have received 4 emails from Google. The output I receive is

Email Brief
===========

Gmail Team \<mail-noreply@google.com\>
--------------------------------------
###Get Gmail on your mobile phone###
 [image: Access Gmail on your mobile phone]
<http://www.google.com/xxxyyy>

Gmail Team \<mail-noreply@google.com\>
--------------------------------------
###Import your contacts and old email###
You can import your contacts and mail from Yahoo!, Hotmail, AOL, and many
other web mail or POP accounts. If you want, we'll even keep importing your
mail for the next 30 days.
     Import contacts and mail
=BB<https://mail.google.com/mail/#settings/accounts>

Gmail Team \<mail-noreply@google.com\>
--------------------------------------
###Customize Gmail with colors and themes###
To spice up your inbox with colors and themes, check out the Themes tab
under Settings.
       Customize Gmail =BB <https://mail.google.com/mail/#settings/themes>

Google+ team \<noreply@plus.google.com\>
-------------------------------------------------
###Getting started on Google+###
Hey,Welcome to Google+ - we're glad you're here! Here's a video and  
some tips to help you get started:

I am a fan of markdown and like reading it as is. But there are many tools which can convert markdown into html including github.com/knieriem/markdown which is written entirely in Go. By saving this markdown to emailbrief.md we can convert this markdown into html.

> go get github.com/knieriem/markdown
> go build github.com/knieriem/markdown/cmd/markdown
> markdown.exe emailbrief.md

This will produce the following output.

<h1>Email Brief</h1>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Get Gmail on your mobile phone</h3>

<p>[image: Access Gmail on your mobile phone]
<a href="http://www.google.com/xxxyyy">http://www.google.com/xxxyyy</a></p>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Import your contacts and old email</h3>

<p>You can import your contacts and mail from Yahoo!, Hotmail, AOL, and many
other web mail or POP accounts. If you want, we'll even keep importing your
mail for the next 30 days.
 Import contacts and mail
=BB<a href="https://mail.google.com/mail/#settings/accounts">https://mail.google.com/mail/#settings/accounts</a></p>

<h2>Gmail Team &lt;mail-noreply@google.com&gt;</h2>

<h3>Customize Gmail with colors and themes</h3>

<p>To spice up your inbox with colors and themes, check out the Themes tab
under Settings.
 Customize Gmail =BB <a href="https://mail.google.com/mail/#settings/themes">https://mail.google.com/mail/#settings/themes</a></p>

<h2>Google+ team &lt;noreply@plus.google.com&gt;</h2>

<h3>Getting started on Google+</h3>

<p>Hey,Welcome to Google+ - we're glad you're here! Here's a video and<br/>
some tips to help you get started:</p>
Be Sociable, Share!

Go – Writing a simple email client

As described in my last post Go – Accessing Gmail with IMAP I have started working on the GoLang IMAP package github.com/NerdGGuy/go-imap. After some restructuring and investigation I have a simple example of how to use the go-imap package.

package main

import (
	"crypto/tls"
	"flag"
	"fmt"
	"github.com/nerdgguy/go-imap"
	"os"
)

func usage() {
	fmt.Print("Only works on Gmail accounts\n")
	fmt.Print("Make sure IMAP is enabled in your Gmail account.")
	fmt.Printf("usage: %s email password\n", os.Args[0])
	os.Exit(0)
}

func main() {
	flag.Parse()

	args := flag.Args()
	if len(args) < 2 {
		usage()
	}
	user := args[0]
	pass := args[1]

	conn, err := tls.Dial("tcp", "imap.gmail.com:993", nil)
	if err != nil {
		fmt.Print("Connection to imap.gmail.com:993 failed")
		os.Exit(1)
	}

	im := imap.New(conn, conn)
	//im.Unsolicited = make(chan interface{}, 100)

	hello, err := im.Start()
	if err != nil {
		fmt.Print("Hello failed")
		os.Exit(1)
	}
	fmt.Printf("Server hello: %s\n", hello)

	fmt.Printf("logging in...\n")
	resp, caps, err := im.Auth(user, pass)
	if err != nil {
		fmt.Print("Auth failed\n")
		os.Exit(1)
	}
	fmt.Printf("Server capabilities: %s\n", caps)
	fmt.Printf("Server resp: %s\n", resp)

	examine, err := im.Examine("INBOX")
	if err != nil {
		fmt.Print("Examine failed\n")
		os.Exit(1)
	}
	fmt.Printf("Mailbox status: %+v\n", examine)

	fresp, err := im.Fetch("1:*", []string{"RFC822"})
	if err != nil {
		fmt.Print("Fetch failed\n")
		os.Exit(1)
	}
	for _, fr := range fresp {
		fmt.Printf("Fetch resp: %v\n", string(fr.Rfc822))
	}
}
Be Sociable, Share!

Go – Accessing Gmail with IMAP

I’m in very early days of updating github.com/martine/go-imap to provide better support for accessing Gmail (and other IMAP email) from GO lang. I’ll provide instructions below on how to run the imapsync demo. I DON’T recommend you run this against your primary email account as this is very alpha software and may irreversibly damage or remove your emails. At the present time imapsync is hardcoded to access Gmail accounts only.

go get github.com/NerdGGuy/go-imap
cd $GOPATH/src/github.com/NerdGGuy/go-imap/imapsync
go run .\main.go .\debug.go .\mbox.go .\netmon.go list <username> <password>
go run .\main.go .\debug.go .\mbox.go .\netmon.go fetch <username> <password> INBOX
Be Sociable, Share!

Graphing in Go – Bulletgraph

You may have noticed in my recent posts (most notably Bitcoin Charts – Bid Comparison) I have been generating bullet graphs using the GO lang package github.com/NerdGGuy/BulletGraphGo. I started writing this package was created when I wanted to generate graphs in GO. There wasn’t much available that fit my needs until I discovered SVGO. By porting the SVGO bullet graph example to a package I was able to generate any bullet graph with ease. Here’s an example of how to generate a simple bullet graph.

package main

import (
	"github.com/NerdGGuy/BulletGraphGo"
	"github.com/ajstarks/svgo"
	"os"
)

func main() {
	canvas := svg.New(os.Stdout)
	canvas.Start(1024, 800)
	canvas.Rect(0, 0, 1024, 800, "fill:white")
	canvas.Gstyle("font-family:Calibri;font-size:18px")
	bg := bulletgraph.New(canvas)
	bg.Data = append(bg.Data, bulletgraph.Bdata{Title: "Test", Subtitle: "subtitle", Scale: "0,60,2", Qmeasure: "27,29", Cmeasure: 27.5, Measure: 28.5})
	bg.Drawbg(canvas)
	canvas.Gend()
	canvas.End()
}

Bullet Graph Example

If you have any questions feel free to ask in the comment/twitter/G+.

Update: I have generated some documentation. I will try and make this more complete in the future.


PACKAGE

package bulletgraph
import “github.com/NerdGGuy/BulletGraphGo”

Package for generating bulletgraphs in SVG – bullet graphs (Design Specification http://www.perceptualedge.com/articles/misc/Bullet_Graph_Design_Spec.pdf)

TYPES

type Bdata struct {
    Title    string
    Subtitle string
    Scale    string
    Qmeasure string
    Cmeasure float64
    Measure  float64
}

Title: Title of the bulletgraph. Displayed on the left of the bullet graph by default.
Subtitle: Subtitle displayed under the title.
Scale: A delimited string indicating the start,end,increment values for the bullet graph e.g. “0,60,2″.
Qmeasure: A delimited string indicating the comparison “zones” in the bullet graph e.g. “27,29″.
Cmeasure: The comparison indicator in the bullet graph. Measure: The measure for the bar to display.

type Bulletgraph struct {
    Top   int
    Left  int
    Right int
    Title string
    Data  []Bdata
    Note  []Note
    Flags Options
}

Top: The top of the first bullet graph.
Left: The leftmost pixel to draw the bullet graph.
Right: The rightmost pixel to draw the bullet graph.
Title: The title of the the generated SVG.
Data: An array of all the bullet graph data.
Note: An array of notes to display at the bottom of the SVG.
Flag: Options for generating bullet graphs.

func New(canvas *svg.SVG) *Bulletgraph

Creates a new Bulletgraph with default options.

func (bg *Bulletgraph) Drawbg(canvas *svg.SVG)
    Drawbg draws the bullet graph onto the canvas
type Note struct {
    Text string `xml:",chardata"`
}

Text: Note to be displayed under the bullet graph.

type Options struct {
    Width, Height, Fontsize, Barheight, Gutter     int
    Bgcolor, Barcolor, Datacolor, Compcolor, Title string
    Showtitle, Circlemark                          bool
}

These options have default values some of which are derived from the canvas.
Width: Width
Height: Height
Fontsize: Fontsize (px)
Barheight: Bar height
Gutter: Height of gutter around bar
Bgcolor: Background color
Barcolor: Bar color
Datacolor: Data color
Compcolor: Comparative color
Title: Title
Showtitle: Show title
Circlemark: Circle mark

Be Sociable, Share!

Bitcoin Charts – Bid Comparison

For information about Bitcoin and its history I provide a brief overview in my other post “Bitcoin – Is it dead yet?“. To better understand bullet graphs have a read of the Bullet Graph Design Spec.

There are a large number of exchanges listed on bitcoincharts.com. These exchanges are all competing to exchange bitcoin for you. For a better understanding of these exchanges I wrote a go script to list the bid prices for all the USD exchanges on bitcoincharts. While some of these exchange appear to be out of operation others show a very competitive exchange rate. The measure (bar) shown on these charts is the best bid price currently being offered. When compared with mtgox some of these exchanges appear to offer a better bid price. On the right side of the bar the lighter color indicates a range where the user would expect to be making a profit on the exchange (approximated as mtgoxUSD.Ask + 1% exchange fee). At the time of producing this graph bitfloor appears to be offering a very competitive price. An intelligent arbitration bot could take advantage of this.

Comparison of bid prices for bitcoin exchanges

I’m not the first to notice this. Searching github shows a few attempts at arbitration on the bitcoin exchanges. My script was written in go and produces an SVG image. Three important packages are used to help produce the image.

1. github.com/ajstarks/svgo – Produces the SVG markup.
2. github.com/NerdGGuy/bitcoincharts – Queries bitcoincharts.com for bitcoin market information.
3. github.com/NerdGGuy/BulletGraphGo – Produces the bullet charts.

The code to produce this chart is below:

package main

import (
	"fmt"
	"github.com/NerdGGuy/BulletGraphGo"
	"github.com/NerdGGuy/bitcoincharts"
	"github.com/ajstarks/svgo"
	"math"
	"os"
	"time"
)

func main() {
	canvas := svg.New(os.Stdout)
	canvas.Start(1024, 1800)
	canvas.Rect(0, 0, 1024, 1800, "fill:white")
	canvas.Gstyle("font-family:Calibri;font-size:18px")
	canvas.Title("Bitcoin Bid Comparison")
	bg := bulletgraph.New(canvas)

	bitcoin := bitcoincharts.BitcoinCharts{Timeout: time.Millisecond * 1000}

	mtgoxUSD, err := bitcoin.GetMarket("mtgoxUSD")
	if err != nil {
		fmt.Errorf("%s: %s", err.MyError, err.TheError)
		return
	}

	usd, err := bitcoin.GetMarketsWithCurrency("USD")
	if err != nil {
		fmt.Errorf("%s: %s", err.MyError, err.TheError)
		return
	}

	//Want to sell bitcoin at a profit
	for _, market := range *usd {

		//SELLING BITCOIN:
		//We will assume the mtgoxUSD.Bid price is current "real" price for selling bitcoin
		//To make a profit we must be able to "buy" the bitcoin back at a better price
		//We will assume the fee for transaction is 1%
		qm := fmt.Sprintf("%v,%v", mtgoxUSD.Bid, mtgoxUSD.Ask+(mtgoxUSD.Ask*0.01))
		scale := fmt.Sprintf("%v,%v,%v", 0, math.Floor(mtgoxUSD.Bid)*2, math.Floor(mtgoxUSD.Bid/12))
		if market.Ask > 0 {
			//CMeasure will be the current Asking price. If someone is lucky enough to get this price they will make a profit.
			//Measure is the actually market.bid price we can currently sell our bitcoin for
			bg.Data = append(bg.Data, bulletgraph.Bdata{Title: market.Symbol, Subtitle: market.Currency, Scale: scale, Qmeasure: qm, Cmeasure: market.Ask, Measure: market.Bid})
		}

		//BUYING BITCOIN
		//--not yet--
	}

	bg.Drawbg(canvas)
	canvas.Gend()
	canvas.End()
}
Be Sociable, Share!

Bullet Charts in Go

I’ve been playing around with bullet graphs in Go. The code will be based on github.com/ajstarks/svgo. These charts will be generate as an SVG chart and will be embedded-able into a webpage. Here’s an example of what I’m working on. I’ll post more details about generating bullet graphs in GoLang in my next post.

package main

import (
	"github.com/NerdGGuy/svgo"
	"os"
)

func main() {
	bg := svg.Bulletgraph{Title: "Bullet Graph", Top: 50, Left: 250, Right: 50}
	bg.Data = append(bg.Data, svg.Bdata{Title: "Revenue 2005", Subtitle: "USD (1,000)", Scale: "0,300,50", Qmeasure: "150,225", Cmeasure: 250, Measure: 275})

	canvas := svg.New(os.Stdout)
	canvas.Start(1024, 800)
	canvas.Rect(0, 0, 1024, 800, "fill:white")
	canvas.Gstyle("font-family:Calibri;font-size:18px")

	bg.Drawbg(canvas)
	canvas.Gend()
	canvas.End()
}

Example output of a bulletgraph from the SVGO GoLang package

Be Sociable, Share!

Using BitcoinCharts JSON API in GO

If you haven’t heard about Bitcoin I provide a brief overview in my post “Bitcoin – Is it dead yet?

BitcoinCharts.com provides an overview of the current bitcoin exchange rate for a vast majority of bitcoin exchanges and their markets. As well as trading prices it also provides trading volumes which is important when making decisions about who to trade with. BitcoinCharts.com also provides a JSON API that gives you access to the vast majority of this information. So if you want to write your own programs to indicate the best rates for your bitcoin exchange or write a trading bot BitcoinCharts.com is a good place to start.

Here I will detail how you can access the BitcoinCharts JSON api in GO (GOLang – golang.org) and print out the asking price. First you will need to install the bitcoincharts package from github.com/nerdgguy/bitcoincharts.

> go get github.com/nerdgguy/bitcoincharts

In this example we will need to import bitcoincharts, fmt, and time. I called my file bitcoincharts.go and add the following:

package main

import (
	"fmt"
	"github.com/NerdGGuy/bitcoincharts"
	"time"
)

The bitcoincharts package works by downloading bitcoincharts.com’s markets.json file and caching it internally. The package lets you set a cache timeout for a BitcoinCharts object. The timeout specifies how long the JSON data is cached before making a new request. In our example we will use 1 second but I recommend you use a much larger timeout to avoid abusing the BitcoinCharts.com api with too many unneeded requests.

func main() {
	bitcoin := bitcoincharts.BitcoinCharts{Timeout: time.Millisecond * 1000}

Next we will want to list which symbols are currently listed on bitcoincharts.com. We can do that using the GetMarketSymbols() call. It returns a string array and an error. The error is nil if the request was successful.

	symbols, err := bitcoin.GetMarketSymbols()
	if err != nil {
		fmt.Errorf("%s: %s", err.MyError, err.TheError)
		return
	}

Now that we have all the symbols we can request the asking price for each market. Since symbols is a string array we can loop over it and request the market asking price. To request the information about the market we can call GetMarket(symbol) which will return a “Market” object and an error.

	fmt.Println("List of markets:")
	for _, symbol := range *symbols {
		market, err := bitcoin.GetMarket(symbol)

The “Market” object contains a variety of information about the market we requested. The Market object is defined as:

type Market struct {
	Symbol          string
	Currency        string
	Bid             float32
	Ask             float32
	Latest_Trade    int
	Open            float32
	High            float32
	Low             float32
	Close           float32
	Previous_Close  float32
	Volume          float32
	Currency_Volume float32
}

In this example we want to print out the asking price. Before we do we must make sure the GetMarket(symbol) request was successful. If the request was successful we will print the symbol and asking price to screen.

		if err != nil {
			fmt.Errorf("%s: %s", err.MyError, err.TheError)
		} else {
			fmt.Printf("%s   \t%f\n", symbol, market.Ask)
		}
	}

Once you have put all this code together and run the example you should get output similar to the following.

> go run bitcoincharts.go
List of markets:
thAUD           0.000000
bitmarketAUD    15.000000
mtgoxAUD        13.062450
ruxumAUD        0.000000
wbxAUD          0.000000
cryptoxAUD      23.000000
mrcdBRL         31.900000
bbmBRL          0.000000
mtgoxCAD        13.483780
virtexCAD       12.980000
mtgoxCHF        12.518450
ruxumCHF        3.900000
thCLP           0.000000
btcnCNY         82.879997
mtgoxCNY        84.761658
mtgoxDKK        77.984741
bcEUR           10.199900
btcexEUR        0.000000
bitmarketEUR    10.300000
thEUR           0.000000
rockEUR         10.390000
b7EUR           0.000000
mtgoxEUR        10.199980
aqoinEUR        0.000000
ruxumEUR        0.000000
intrsngEUR      10.198700
btcdeEUR        10.110000
globalEUR       0.000000
vcxEUR          10.700000
imcexEUR        4.870000
btc24EUR        10.169990
bitcurexEUR     10.300000
btceEUR         9.000000
bcmPXGAU        0.000000
bcmBMGAU        0.000000
britcoinGBP     0.000000
bitmarketGBP    9.810000
bcGBP           8.680070
mtgoxGBP        8.449000
intrsngGBP      11.500000
ruxumGBP        3.500000
globalGBP       0.000000
mtgoxHKD        105.453110
ruxumHKD        48.000000
ruxumHUF        1300.000000
thINR           0.000000
btcexJPY        0.000000
ruxumJPY        490.000000
mtgoxJPY        1201.904053
bitnzNZD        17.500000
mtgoxNZD        16.443590
bitomatPLN      0.000000
bitmarketPLN    43.000000
bitchangePLN    0.000000
mtgoxPLN        42.000000
intrsngPLN      40.900002
ruxumPLN        18.000000
globalPLN       0.000000
freshPLN        0.000000
bitcurexPLN     40.599998
btcexWMR        0.000000
btcexRUB        0.000000
btcexYAD        0.000000
bitmarketRUB    0.000000
mtgoxRUB        414.602661
ruxumRUB        195.000000
mtgoxSEK        89.191002
ruxumSEK        35.000000
kptnSEK         94.900002
mtgoxSGD        16.742599
ruxumSGD        0.000000
virwoxSLL       3550.000000
rockSLL         3515.000000
ruxumTHB        175.000000
mtgoxTHB        415.062683
ruxumUAH        45.000000
bcmPPUSD        0.000000
mtgoxUSD        13.422170
bcmLRUSD        0.000000
btcexUSD        0.000000
btcexWMZ        0.000000
bcmBMUSD        0.000000
bcmMBUSD        0.000000
b2cUSD          0.000000
bitmarketUSD    14.500000
thLRUSD         0.000000
thUSD           0.000000
vcxUSD          13.700000
exchbUSD        0.000000
b7USD           0.000000
ruxumUSD        15.000000
cbxUSD          13.590000
btceUSD         13.120000
bitstampUSD     13.150000
globalUSD       0.000000
intrsngUSD      0.000000
bitfloorUSD     13.430000
rockUSD         13.600000
cryptoxUSD      13.672050
icbitUSD        13.600000
bitmeUSD        13.410000
imcexUSD        5.200000
btctreeUSD      0.000000
btc24USD        13.312120
ruxumZAR        41.000000

Hopefully the brief overview above made sense. Please feel free to leave me a message if you have and question about the use of the bitcoincharts package. Here is the full code used in my example.

package main

import (
	"fmt"
	"github.com/NerdGGuy/bitcoincharts"
	"time"
)

func main() {
	bitcoin := bitcoincharts.BitcoinCharts{Timeout: time.Millisecond * 1000}

	symbols, err := bitcoin.GetMarketSymbols()
	if err != nil {
		fmt.Errorf("%s: %s", err.MyError, err.TheError)
		return
	}

	fmt.Println("List of markets:")
	for _, symbol := range *symbols {
		market, err := bitcoin.GetMarket(symbol)
		if err != nil {
			fmt.Errorf("%s: %s", err.MyError, err.TheError)
		} else {
			last := float32(market.Latest_Trade) / 100000000
			fmt.Printf("%s   \t%f\n", symbol, last)
		}
	}
}
Be Sociable, Share!