| 1 | package Finance::GDAX::API::TypeConstraints; | ||
| 2 | our $VERSION = '0.01'; | ||
| 3 | use 5.20.0; | ||
| 4 | use warnings; | ||
| 5 | use Moose; | ||
| 6 | use Moose::Util::TypeConstraints; | ||
| 7 | use namespace::autoclean; | ||
| 8 | |||
| 9 | subtype 'PositiveInt', | ||
| 10 | as 'Int', | ||
| 11 | where { $_ > 0 }, | ||
| 12 | message { "$_ is not a positive number" }; | ||
| 13 | |||
| 14 | subtype 'PositiveNum', | ||
| 15 | as 'Num', | ||
| 16 | where { $_ > 0 }, | ||
| 17 | message { "$_ is not a positive number" }; | ||
| 18 | |||
| 19 | subtype 'PositiveNumOrZero', | ||
| 20 | as 'Num', | ||
| 21 | where { $_ >= 0 }, | ||
| 22 | message { "$_ is not a positive number or zero" }; | ||
| 23 | |||
| 24 | subtype 'ProductLevel', | ||
| 25 | as 'Int', | ||
| 26 | where { $_ >= 1 and $_ <= 3 }, | ||
| 27 | message { "Product level must be 1, 2 or 3" }; | ||
| 28 | |||
| 29 | enum 'FundingStatus', [qw(outstanding settled rejected)]; | ||
| 30 | enum 'MarginTransferType', [qw(deposit withdraw)]; | ||
| 31 | enum 'OrderSelfTradePreventionFlag', [qw(dc co cn cb)]; | ||
| 32 | enum 'OrderSide', [qw(buy sell)]; | ||
| 33 | enum 'OrderTimeInForce', [qw(GTC GTT IOC FOK)]; | ||
| 34 | enum 'OrderType', [qw(limit market stop)]; | ||
| 35 | enum 'ReportFormat', [qw(pdf csv)]; | ||
| 36 | enum 'ReportType', [qw(fills account)]; | ||
| 37 | |||
| 38 | __PACKAGE__->meta->make_immutable; | ||
| 39 | 1; | ||
| 40 |