#!/usr/bin/env perl

use strict;

use Finance::Nadex;

if (! $ENV{NADEXUSERNAME} || ! $ENV{NADEXPASSWORD}) {
    die "to use this program, you must set NADEXUSERNAME and NADEXPASSWORD in your environment with your Nadex username and password\n";
}

# connects to the live platform; alternatively, connect to demo with my $client = Finance::Nadex->new(platform => 'demo');
my $client = Finance::Nadex->new();
$client->login(username => $ENV{NADEXUSERNAME}, password => $ENV{NADEXPASSWORD});

foreach my $market ($client->get_market_instruments( name => 'Forex (Spreads)' )) {
    print $market, "\n";
}