#!/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});

my @orders = $client->retrieve_orders();

foreach my $order (@orders) {
    print join(" ", $order->id, $order->direction, $order->size, $order->contract, $order->price), "\n";
}

