App-cryp-arbit

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "runtime" : {
         "requires" : {
            "App::cryp::exchange" : "0.010",
            "CryptoExchange::Catalog" : "20180510",
            "DBIx::Connect::MySQL" : "0",
            "Data::Sah::Coerce::perl::To_date::From_float::epoch" : "0",
            "Data::Sah::Coerce::perl::To_date::From_obj::datetime" : "0",
            "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" : "0",
            "Data::Sah::Coerce::perl::To_date::From_str::iso8601" : "0",
            "Data::Sah::Coerce::perl::To_float::From_str::percent" : "0",
            "Data::Sah::Coerce::perl::To_str::From_str::normalize_cryptoexchange_account" : "0",
            "Data::Sah::Coerce::perl::To_str::From_str::to_cryptocurrency_code" : "0",
            "Data::Sah::Coerce::perl::To_str::From_str::to_fiat_or_cryptocurrency_code" : "0",
            "Data::Sah::Compiler::perl::TH::array" : "0",
            "Data::Sah::Compiler::perl::TH::bool" : "0",
            "Data::Sah::Compiler::perl::TH::date" : "0",
            "Data::Sah::Compiler::perl::TH::float" : "0",
            "Data::Sah::Compiler::perl::TH::hash" : "0",
            "Data::Sah::Compiler::perl::TH::int" : "0",
            "Data::Sah::Compiler::perl::TH::str" : "0",

META.yml  view on Meta::CPAN

  version: '1.4'
name: App-cryp-arbit
requires:
  App::cryp::exchange: '0.010'
  CryptoExchange::Catalog: '20180510'
  DBIx::Connect::MySQL: '0'
  Data::Sah::Coerce::perl::To_date::From_float::epoch: '0'
  Data::Sah::Coerce::perl::To_date::From_obj::datetime: '0'
  Data::Sah::Coerce::perl::To_date::From_obj::time_moment: '0'
  Data::Sah::Coerce::perl::To_date::From_str::iso8601: '0'
  Data::Sah::Coerce::perl::To_float::From_str::percent: '0'
  Data::Sah::Coerce::perl::To_str::From_str::normalize_cryptoexchange_account: '0'
  Data::Sah::Coerce::perl::To_str::From_str::to_cryptocurrency_code: '0'
  Data::Sah::Coerce::perl::To_str::From_str::to_fiat_or_cryptocurrency_code: '0'
  Data::Sah::Compiler::perl::TH::array: '0'
  Data::Sah::Compiler::perl::TH::bool: '0'
  Data::Sah::Compiler::perl::TH::date: '0'
  Data::Sah::Compiler::perl::TH::float: '0'
  Data::Sah::Compiler::perl::TH::hash: '0'
  Data::Sah::Compiler::perl::TH::int: '0'
  Data::Sah::Compiler::perl::TH::str: '0'

Makefile.PL  view on Meta::CPAN

  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "App::cryp::arbit",
  "PREREQ_PM" => {
    "App::cryp::exchange" => "0.010",
    "CryptoExchange::Catalog" => 20180510,
    "DBIx::Connect::MySQL" => 0,
    "Data::Sah::Coerce::perl::To_date::From_float::epoch" => 0,
    "Data::Sah::Coerce::perl::To_date::From_obj::datetime" => 0,
    "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" => 0,
    "Data::Sah::Coerce::perl::To_date::From_str::iso8601" => 0,
    "Data::Sah::Coerce::perl::To_float::From_str::percent" => 0,
    "Data::Sah::Coerce::perl::To_str::From_str::normalize_cryptoexchange_account" => 0,
    "Data::Sah::Coerce::perl::To_str::From_str::to_cryptocurrency_code" => 0,
    "Data::Sah::Coerce::perl::To_str::From_str::to_fiat_or_cryptocurrency_code" => 0,
    "Data::Sah::Compiler::perl::TH::array" => 0,
    "Data::Sah::Compiler::perl::TH::bool" => 0,
    "Data::Sah::Compiler::perl::TH::date" => 0,
    "Data::Sah::Compiler::perl::TH::float" => 0,
    "Data::Sah::Compiler::perl::TH::hash" => 0,
    "Data::Sah::Compiler::perl::TH::int" => 0,
    "Data::Sah::Compiler::perl::TH::str" => 0,

Makefile.PL  view on Meta::CPAN



my %FallbackPrereqs = (
  "App::cryp::exchange" => "0.010",
  "CryptoExchange::Catalog" => 20180510,
  "DBIx::Connect::MySQL" => 0,
  "Data::Sah::Coerce::perl::To_date::From_float::epoch" => 0,
  "Data::Sah::Coerce::perl::To_date::From_obj::datetime" => 0,
  "Data::Sah::Coerce::perl::To_date::From_obj::time_moment" => 0,
  "Data::Sah::Coerce::perl::To_date::From_str::iso8601" => 0,
  "Data::Sah::Coerce::perl::To_float::From_str::percent" => 0,
  "Data::Sah::Coerce::perl::To_str::From_str::normalize_cryptoexchange_account" => 0,
  "Data::Sah::Coerce::perl::To_str::From_str::to_cryptocurrency_code" => 0,
  "Data::Sah::Coerce::perl::To_str::From_str::to_fiat_or_cryptocurrency_code" => 0,
  "Data::Sah::Compiler::perl::TH::array" => 0,
  "Data::Sah::Compiler::perl::TH::bool" => 0,
  "Data::Sah::Compiler::perl::TH::date" => 0,
  "Data::Sah::Compiler::perl::TH::float" => 0,
  "Data::Sah::Compiler::perl::TH::hash" => 0,
  "Data::Sah::Compiler::perl::TH::int" => 0,
  "Data::Sah::Compiler::perl::TH::str" => 0,

README  view on Meta::CPAN

    Please see included script cryp-arbit.

DESCRIPTION
  Glossary
    *   inventory

    *   order pair

    *   gross profit margin

        Price difference percentage of a cryptocurrency between two
        exchanges, without taking into account trading fees and foreign
        exchange spread.

        For example, suppose BTC is being offered (ask price, sell price) at
        7010 USD on exchange1 and is being bidden (bid price, buy price) at
        7150 USD on exchange2. This means there is a (7150-7010)/7010 =
        1.997% gross profit margin. We can buy BTC on exchange1 for 7010 USD
        then sell the same amout of BTC on exchange2 for 7150 USD and gain
        (7150-7010) = 140 USD per BTC, before fees.

    *   trading profit margin

        Price difference percentage of a cryptocurrency between two
        exchanges, after taking into account trading fees.

        For example, suppose BTC is being offered (ask price, sell price) at
        7010 USD on exchange1 and is being bidden (bid price, buy price) at
        7150 USD on exchange2. Trading (market maker) fee on exchange1 is
        0.3% and on exchange2 is 0.25%. After trading fees, the ask price
        becomes 7010 * (1+0.3%) = 7031.03 USD and the bid price becomes 7150
        * (1-0.25%) = 7132.125. The trading profit margin is
        (7132.125-7031.03)/7031.03 = 1.438%. We can buy BTC on exchange1 for
        7010 USD then sell the same amout of BTC on exchange2 for 7150 USD
        and still gain (7132.125-7031.03) = 101.095 USD per BTC, after
        trading fees.

    *   net profit margin

        Price difference percentage of a cryptocurrency between two
        exchanges, after taking into account trading fees and foreign
        exchange spread. If the price on both exchanges are quoted in the
        same currency (e.g. USD) then there is no forex spread and net
        profit margin is the same as trading profit margin.

        If the quoting currencies are different, e.g. USD on exchange1 and
        IDR on exchange2, then first we calculate gross and trading profit
        margin using prices converted to USD using average forex rate
        (highest forex dealer's sell price + lowest buy price, divided by
        two). Then we subtract trading profit margin with forex spread for

README  view on Meta::CPAN

       {account_balances}          # key=exchange safename, value={currency1 => [{account=>account1, account_id=>aid, available=>..., ...}, {...}]}. value->{currency} sorted by largest available balance first
       {account_exchanges}         # key=exchange safename, value={account1 => 1, ...}
       {account_ids}               # key=exchange safename, value={account1 => numeric ID from db, ...}
       {base_currencies}           # target (crypto)currencies to arbitrage
       {exchange_clients}          # key=exchange safename, value={account1 => $client1, ...}
       {exchange_ids}              # key=exchange safename, value=exchange (numeric) ID from db
       {exchange_recs}             # key=exchange safename, value=hash (from CryptoExchange::Catalog)
       {exchange_coins}            # key=exchange safename, value=[COIN1, COIN2, ...]
       {exchange_pairs}            # key=exchange safename, value=[{name=>PAIR1, min_base_size=>..., min_quote_size=>...}, ...]
       {forex_rates}               # key=currency pair (e.g. IDR/USD), val=exchange rate (avg rate)
       {forex_spreads}             # key=fiat currency pair, e.g. USD/IDR, value=percentage
       {fx}                        # key=currency value=result from get_spot_rate()
       {order_pairs}               # result from calculate_order_pairs()
       {quote_currencies}          # what currencies we use to buy/sell the base currencies
       {quote_currencies_for}      # key=base currency, value={quotecurrency1 => 1, quotecurrency2=>1, ...}
       {trading_fees}              # key=exchange safename, value={coin1=>num (in percent) market taker fees, ...}, ':default' for all other coins, ':default' for all other exchanges

FUNCTIONS
  arbit
    Usage:

     arbit(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Perform arbitrage.

    This utility monitors prices of several cryptocurrencies ("base

README  view on Meta::CPAN

        of a pair of orders, where one order is a selling order at a higher
        quote currency size than the buying order).

        For example if you are arbitraging BTC against USD and IDR, and set
        this option to 75, then orders will not be above 75 USD. If you are
        arbitraging LTC against BTC and set this to 0.03 then orders will
        not be above 0.03 BTC.

        Suggestion: If you set this option too high, a few orders can use up
        your inventory (and you might not be getting optimal profit
        percentage). Also, large orders can take a while (or too long) to
        fill. If you set this option too low, you will hit the exchanges'
        minimum order size and no orders can be created. Since we want
        smaller risk of orders not getting filled quickly, we want small
        order sizes. The optimum number range a little above the exchanges'
        minimum order size.

    *   min_account_balances => *hash*

        What are the minimum account balances.

    *   min_net_profit_margin => *float* (default: 0)

        Minimum net profit margin that will trigger an arbitrage trading, in
        percentage.

        Below this percentage number, no order pairs will be sent to the
        exchanges to do the arbitrage. Note that the net profit margin
        already takes into account trading fees and forex spread (see
        Glossary section for more details and illustration).

        Suggestion: If you set this option too high, there might not be any
        order pairs possible. If you set this option too low, you will be
        getting too thin profits. Run "cryp-arbit opportunities" or
        "cryp-arbit arbit --dry-run" for a while to see what the average
        percentage is and then decide at which point you want to perform
        arbitrage.

    *   quote_currencies => *array[fiat_or_cryptocurrency]*

        The currencies to exchange (buy/sell) the target currencies.

        You can have fiat currencies as the quote currencies, to buy/sell
        the target (base) currencies during arbitrage. For example, to
        arbitrage LTC against USD and IDR, "base_currencies" is ['BTC'] and
        "quote_currencies" is ['USD', 'IDR'].

README  view on Meta::CPAN

        of a pair of orders, where one order is a selling order at a higher
        quote currency size than the buying order).

        For example if you are arbitraging BTC against USD and IDR, and set
        this option to 75, then orders will not be above 75 USD. If you are
        arbitraging LTC against BTC and set this to 0.03 then orders will
        not be above 0.03 BTC.

        Suggestion: If you set this option too high, a few orders can use up
        your inventory (and you might not be getting optimal profit
        percentage). Also, large orders can take a while (or too long) to
        fill. If you set this option too low, you will hit the exchanges'
        minimum order size and no orders can be created. Since we want
        smaller risk of orders not getting filled quickly, we want small
        order sizes. The optimum number range a little above the exchanges'
        minimum order size.

    *   min_account_balances => *hash*

        What are the minimum account balances.

    *   min_net_profit_margin => *float* (default: 0)

        Minimum net profit margin that will trigger an arbitrage trading, in
        percentage.

        Below this percentage number, no order pairs will be sent to the
        exchanges to do the arbitrage. Note that the net profit margin
        already takes into account trading fees and forex spread (see
        Glossary section for more details and illustration).

        Suggestion: If you set this option too high, there might not be any
        order pairs possible. If you set this option too low, you will be
        getting too thin profits. Run "cryp-arbit opportunities" or
        "cryp-arbit arbit --dry-run" for a while to see what the average
        percentage is and then decide at which point you want to perform
        arbitrage.

    *   quote_currencies => *array[fiat_or_cryptocurrency]*

        The currencies to exchange (buy/sell) the target currencies.

        You can have fiat currencies as the quote currencies, to buy/sell
        the target (base) currencies during arbitrage. For example, to
        arbitrage LTC against USD and IDR, "base_currencies" is ['BTC'] and
        "quote_currencies" is ['USD', 'IDR'].

lib/App/cryp/arbit.pm  view on Meta::CPAN

        default => 'merge_order_book',
        description => <<'_',

Strategy is implemented in a `App::cryp::arbit::Strategy::*` perl module.

_
    },
    %args_accounts_and_currencies,
    min_net_profit_margin => {
        summary => 'Minimum net profit margin that will trigger an arbitrage '.
            'trading, in percentage',
        schema => 'float*',
        default => 0,
        description => <<'_',

Below this percentage number, no order pairs will be sent to the exchanges to do
the arbitrage. Note that the net profit margin already takes into account
trading fees and forex spread (see Glossary section for more details and
illustration).

Suggestion: If you set this option too high, there might not be any order pairs
possible. If you set this option too low, you will be getting too thin profits.
Run `cryp-arbit opportunities` or `cryp-arbit arbit --dry-run` for a while to
see what the average percentage is and then decide at which point you want to
perform arbitrage.

_
    },
    max_order_quote_size => {
        summary => 'What is the maximum amount of a single order',
        schema => 'float*',
        default => 100,
        description => <<'_',

A single order will be limited to not be above this value (in quote currency,
which if fiat will be converted to USD). This is the amount for the buying
(because an arbitrage transaction is comprised of a pair of orders, where one
order is a selling order at a higher quote currency size than the buying order).

For example if you are arbitraging BTC against USD and IDR, and set this option
to 75, then orders will not be above 75 USD. If you are arbitraging LTC against
BTC and set this to 0.03 then orders will not be above 0.03 BTC.

Suggestion: If you set this option too high, a few orders can use up your
inventory (and you might not be getting optimal profit percentage). Also, large
orders can take a while (or too long) to fill. If you set this option too low,
you will hit the exchanges' minimum order size and no orders can be created.
Since we want smaller risk of orders not getting filled quickly, we want small
order sizes. The optimum number range a little above the exchanges' minimum
order size.

_
    },
    max_order_pairs_per_round => {
        summary => 'Maximum number of order pairs to create per round',

lib/App/cryp/arbit.pm  view on Meta::CPAN

             price DECIMAL(21,8) NOT NULL
         ) ENGINE=MyISAM',

        'CREATE TABLE order_pair (
             id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
             ctime DOUBLE NOT NULL, INDEX(ctime), -- create time in our database

             base_currency VARCHAR(10) NOT NULL, -- the currency we are arbitraging, e.g. LTC
             base_size DECIMAL(21,8) NOT NULL, -- amount of "currency" that we are arbitraging (sell on "sell exchange" and buy on "buy exchange")

             expected_profit_margin DOUBLE NOT NULL, -- expected profit percentage (after trading fees & forex spread)
             expected_net_profit DOUBLE NOT NULL, -- expected net profit (after trading fees & forex spread) in quote currency (converted to USD if fiat) if fully executed

             -- we buy "base_size" of "base_currency" on "buy exchange" at
             -- "buy_gross_price_orig" (in "buy_quote_currency") a.k.a
             -- "buy_gross_price" (in "buy_quote_currency" converted to USD if
             -- fiat)

             -- possible statuses/lifecyle: creating (submitting to exchange),
             -- open (created and open), cancelling, cancelled, done

lib/App/cryp/arbit.pm  view on Meta::CPAN

             net_profit_margin DOUBLE
         )',

        'CREATE TABLE order_pair (
             id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
             ctime DOUBLE NOT NULL, INDEX(ctime), -- create time in our database

             base_currency VARCHAR(10) NOT NULL, -- the currency we are arbitraging, e.g. LTC
             base_size DECIMAL(21,8) NOT NULL, -- amount of "currency" that we are arbitraging (sell on "sell exchange" and buy on "buy exchange")

             expected_profit_margin DOUBLE NOT NULL, -- expected profit percentage (after trading fees & forex spread)
             expected_net_profit DOUBLE NOT NULL, -- expected net profit (after trading fees & forex spread) in quote currency (converted to USD if fiat) if fully executed

             -- we buy "base_size" of "base_currency" on "buy exchange" at
             -- "buy_gross_price_orig" (in "buy_quote_currency") a.k.a
             -- "buy_gross_price" (in "buy_quote_currency" converted to USD if
             -- fiat)

             -- possible statuses/lifecyle: creating (submitting to exchange),
             -- open (created and open), cancelling, cancelled, done

lib/App/cryp/arbit.pm  view on Meta::CPAN

=head2 Glossary

=over

=item * inventory

=item * order pair

=item * gross profit margin

Price difference percentage of a cryptocurrency between two exchanges, without
taking into account trading fees and foreign exchange spread.

For example, suppose BTC is being offered (ask price, sell price) at 7010 USD on
exchange1 and is being bidden (bid price, buy price) at 7150 USD on exchange2.
This means there is a (7150-7010)/7010 = 1.997% gross profit margin. We can buy
BTC on exchange1 for 7010 USD then sell the same amout of BTC on exchange2 for
7150 USD and gain (7150-7010) = 140 USD per BTC, before fees.

=item * trading profit margin

Price difference percentage of a cryptocurrency between two exchanges, after
taking into account trading fees.

For example, suppose BTC is being offered (ask price, sell price) at 7010 USD on
exchange1 and is being bidden (bid price, buy price) at 7150 USD on exchange2.
Trading (market maker) fee on exchange1 is 0.3% and on exchange2 is 0.25%. After
trading fees, the ask price becomes 7010 * (1+0.3%) = 7031.03 USD and the bid
price becomes 7150 * (1-0.25%) = 7132.125. The trading profit margin is
(7132.125-7031.03)/7031.03 = 1.438%. We can buy BTC on exchange1 for 7010 USD
then sell the same amout of BTC on exchange2 for 7150 USD and still gain
(7132.125-7031.03) = 101.095 USD per BTC, after trading fees.

=item * net profit margin

Price difference percentage of a cryptocurrency between two exchanges, after
taking into account trading fees and foreign exchange spread. If the price on
both exchanges are quoted in the same currency (e.g. USD) then there is no forex
spread and net profit margin is the same as trading profit margin.

If the quoting currencies are different, e.g. USD on exchange1 and IDR on
exchange2, then first we calculate gross and trading profit margin using prices
converted to USD using average forex rate (highest forex dealer's sell price +
lowest buy price, divided by two). Then we subtract trading profit margin with
forex spread for safety.

lib/App/cryp/arbit.pm  view on Meta::CPAN

   {account_balances}          # key=exchange safename, value={currency1 => [{account=>account1, account_id=>aid, available=>..., ...}, {...}]}. value->{currency} sorted by largest available balance first
   {account_exchanges}         # key=exchange safename, value={account1 => 1, ...}
   {account_ids}               # key=exchange safename, value={account1 => numeric ID from db, ...}
   {base_currencies}           # target (crypto)currencies to arbitrage
   {exchange_clients}          # key=exchange safename, value={account1 => $client1, ...}
   {exchange_ids}              # key=exchange safename, value=exchange (numeric) ID from db
   {exchange_recs}             # key=exchange safename, value=hash (from CryptoExchange::Catalog)
   {exchange_coins}            # key=exchange safename, value=[COIN1, COIN2, ...]
   {exchange_pairs}            # key=exchange safename, value=[{name=>PAIR1, min_base_size=>..., min_quote_size=>...}, ...]
   {forex_rates}               # key=currency pair (e.g. IDR/USD), val=exchange rate (avg rate)
   {forex_spreads}             # key=fiat currency pair, e.g. USD/IDR, value=percentage
   {fx}                        # key=currency value=result from get_spot_rate()
   {order_pairs}               # result from calculate_order_pairs()
   {quote_currencies}          # what currencies we use to buy/sell the base currencies
   {quote_currencies_for}      # key=base currency, value={quotecurrency1 => 1, quotecurrency2=>1, ...}
   {trading_fees}              # key=exchange safename, value={coin1=>num (in percent) market taker fees, ...}, ':default' for all other coins, ':default' for all other exchanges

=head1 FUNCTIONS


=head2 arbit

Usage:

 arbit(%args) -> [$status_code, $reason, $payload, \%result_meta]

lib/App/cryp/arbit.pm  view on Meta::CPAN

A single order will be limited to not be above this value (in quote currency,
which if fiat will be converted to USD). This is the amount for the buying
(because an arbitrage transaction is comprised of a pair of orders, where one
order is a selling order at a higher quote currency size than the buying order).

For example if you are arbitraging BTC against USD and IDR, and set this option
to 75, then orders will not be above 75 USD. If you are arbitraging LTC against
BTC and set this to 0.03 then orders will not be above 0.03 BTC.

Suggestion: If you set this option too high, a few orders can use up your
inventory (and you might not be getting optimal profit percentage). Also, large
orders can take a while (or too long) to fill. If you set this option too low,
you will hit the exchanges' minimum order size and no orders can be created.
Since we want smaller risk of orders not getting filled quickly, we want small
order sizes. The optimum number range a little above the exchanges' minimum
order size.

=item * B<min_account_balances> => I<hash>

What are the minimum account balances.

=item * B<min_net_profit_margin> => I<float> (default: 0)

Minimum net profit margin that will trigger an arbitrage trading, in percentage.

Below this percentage number, no order pairs will be sent to the exchanges to do
the arbitrage. Note that the net profit margin already takes into account
trading fees and forex spread (see Glossary section for more details and
illustration).

Suggestion: If you set this option too high, there might not be any order pairs
possible. If you set this option too low, you will be getting too thin profits.
Run C<cryp-arbit opportunities> or C<cryp-arbit arbit --dry-run> for a while to
see what the average percentage is and then decide at which point you want to
perform arbitrage.

=item * B<quote_currencies> => I<array[fiat_or_cryptocurrency]>

The currencies to exchange (buyE<sol>sell) the target currencies.

You can have fiat currencies as the quote currencies, to buy/sell the target
(base) currencies during arbitrage. For example, to arbitrage LTC against USD
and IDR, C<base_currencies> is ['BTC'] and C<quote_currencies> is ['USD', 'IDR'].

lib/App/cryp/arbit.pm  view on Meta::CPAN

A single order will be limited to not be above this value (in quote currency,
which if fiat will be converted to USD). This is the amount for the buying
(because an arbitrage transaction is comprised of a pair of orders, where one
order is a selling order at a higher quote currency size than the buying order).

For example if you are arbitraging BTC against USD and IDR, and set this option
to 75, then orders will not be above 75 USD. If you are arbitraging LTC against
BTC and set this to 0.03 then orders will not be above 0.03 BTC.

Suggestion: If you set this option too high, a few orders can use up your
inventory (and you might not be getting optimal profit percentage). Also, large
orders can take a while (or too long) to fill. If you set this option too low,
you will hit the exchanges' minimum order size and no orders can be created.
Since we want smaller risk of orders not getting filled quickly, we want small
order sizes. The optimum number range a little above the exchanges' minimum
order size.

=item * B<min_account_balances> => I<hash>

What are the minimum account balances.

=item * B<min_net_profit_margin> => I<float> (default: 0)

Minimum net profit margin that will trigger an arbitrage trading, in percentage.

Below this percentage number, no order pairs will be sent to the exchanges to do
the arbitrage. Note that the net profit margin already takes into account
trading fees and forex spread (see Glossary section for more details and
illustration).

Suggestion: If you set this option too high, there might not be any order pairs
possible. If you set this option too low, you will be getting too thin profits.
Run C<cryp-arbit opportunities> or C<cryp-arbit arbit --dry-run> for a while to
see what the average percentage is and then decide at which point you want to
perform arbitrage.

=item * B<quote_currencies> => I<array[fiat_or_cryptocurrency]>

The currencies to exchange (buyE<sol>sell) the target currencies.

You can have fiat currencies as the quote currencies, to buy/sell the target
(base) currencies during arbitrage. For example, to arbitrage LTC against USD
and IDR, C<base_currencies> is ['BTC'] and C<quote_currencies> is ['USD', 'IDR'].

lib/App/cryp/arbit/Strategy/merge_order_book.pm  view on Meta::CPAN


  GET_ACCOUNT_BALANCES:
    {
        last if $r->{args}{ignore_balance};
        App::cryp::arbit::_get_account_balances($r, 'no-cache');
    } # GET_ACCOUNT_BALANCES

  GET_FOREX_RATES:
    {
        # get foreign fiat currency vs USD exchange rate. we'll use the average
        # rate for this first. but we'll adjust the price difference percentage
        # with the buy-sell spread later.

        my %seen;

        $r->{_stash}{forex_rates} = {};

        for my $cur (@{ $r->{_stash}{quote_currencies} }) {
            next unless App::cryp::arbit::_is_fiat($cur);
            next if $cur eq 'USD';
            next if $seen{$cur}++;

lib/App/cryp/arbit/Strategy/merge_order_book.pm  view on Meta::CPAN

            my $fxrate_avg = ($fxres_low->[2]{rate} + $fxres_high->[2]{rate})/2;
            $r->{_stash}{forex_rates}{"$cur/USD"} = $fxrate_avg;
        }
    } # GET_FOREX_RATES

  GET_FOREX_SPREADS:
    {
        # when we arbitrage using two different fiat currencies, e.g. BTC/USD
        # and BTC/IDR, we want to take into account the USD/IDR buy-sell spread
        # (the "forex spread") and subtract this from the price difference
        # percentage to be safer.

        $r->{_stash}{forex_spreads} = {};

        my @curs;
        for my $cur (@{ $r->{_stash}{quote_currencies} }) {
            next unless App::cryp::arbit::_is_fiat($cur);
            push @curs, $cur unless grep { $cur eq $_ } @curs;
        }
        last unless @curs;

script/cryp-arbit  view on Meta::CPAN

A single order will be limited to not be above this value (in quote currency,
which if fiat will be converted to USD). This is the amount for the buying
(because an arbitrage transaction is comprised of a pair of orders, where one
order is a selling order at a higher quote currency size than the buying order).

For example if you are arbitraging BTC against USD and IDR, and set this option
to 75, then orders will not be above 75 USD. If you are arbitraging LTC against
BTC and set this to 0.03 then orders will not be above 0.03 BTC.

Suggestion: If you set this option too high, a few orders can use up your
inventory (and you might not be getting optimal profit percentage). Also, large
orders can take a while (or too long) to fill. If you set this option too low,
you will hit the exchanges' minimum order size and no orders can be created.
Since we want smaller risk of orders not getting filled quickly, we want small
order sizes. The optimum number range a little above the exchanges' minimum
order size.


=item B<--min-account-balances-json>=I<s>

What are the minimum account balances (JSON-encoded).

See C<--min-account-balances>.

=item B<--min-account-balances>=I<s>

What are the minimum account balances.

=item B<--min-net-profit-margin>=I<s>

Minimum net profit margin that will trigger an arbitrage trading, in percentage.

Default value:

 0

Below this percentage number, no order pairs will be sent to the exchanges to do
the arbitrage. Note that the net profit margin already takes into account
trading fees and forex spread (see Glossary section for more details and
illustration).

Suggestion: If you set this option too high, there might not be any order pairs
possible. If you set this option too low, you will be getting too thin profits.
Run `cryp-arbit opportunities` or `cryp-arbit arbit --dry-run` for a while to
see what the average percentage is and then decide at which point you want to
perform arbitrage.


=item B<--quote-currencies-json>=I<s>

The currencies to exchange (buy/sell) the target currencies (JSON-encoded).

See C<--quote-currency>.

=item B<--quote-currency>=I<s@>

script/cryp-arbit  view on Meta::CPAN

A single order will be limited to not be above this value (in quote currency,
which if fiat will be converted to USD). This is the amount for the buying
(because an arbitrage transaction is comprised of a pair of orders, where one
order is a selling order at a higher quote currency size than the buying order).

For example if you are arbitraging BTC against USD and IDR, and set this option
to 75, then orders will not be above 75 USD. If you are arbitraging LTC against
BTC and set this to 0.03 then orders will not be above 0.03 BTC.

Suggestion: If you set this option too high, a few orders can use up your
inventory (and you might not be getting optimal profit percentage). Also, large
orders can take a while (or too long) to fill. If you set this option too low,
you will hit the exchanges' minimum order size and no orders can be created.
Since we want smaller risk of orders not getting filled quickly, we want small
order sizes. The optimum number range a little above the exchanges' minimum
order size.


=item B<--min-account-balances-json>=I<s>

What are the minimum account balances (JSON-encoded).

See C<--min-account-balances>.

=item B<--min-account-balances>=I<s>

What are the minimum account balances.

=item B<--min-net-profit-margin>=I<s>

Minimum net profit margin that will trigger an arbitrage trading, in percentage.

Default value:

 0

Below this percentage number, no order pairs will be sent to the exchanges to do
the arbitrage. Note that the net profit margin already takes into account
trading fees and forex spread (see Glossary section for more details and
illustration).

Suggestion: If you set this option too high, there might not be any order pairs
possible. If you set this option too low, you will be getting too thin profits.
Run `cryp-arbit opportunities` or `cryp-arbit arbit --dry-run` for a while to
see what the average percentage is and then decide at which point you want to
perform arbitrage.


=item B<--quote-currencies-json>=I<s>

The currencies to exchange (buy/sell) the target currencies (JSON-encoded).

See C<--quote-currency>.

=item B<--quote-currency>=I<s@>



( run in 0.404 second using v1.01-cache-2.11-cpan-05162d3a2b1 )