Skip to content

Commit

Permalink
Update gateioApi.pl
Browse files Browse the repository at this point in the history
gateio.io 修改为 gateio.co
  • Loading branch information
kefengxu authored Aug 27, 2019
1 parent ffc6dd9 commit 6267009
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions perl/gateioApi.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package GateIO;
use Mojo::UserAgent;
use Digest::SHA qw(hmac_sha512_hex);

use constant API_QUERY => 'https://data.gateio.io';
use constant API_TRADE => 'https://api.gateio.io';
use constant API_QUERY => 'https://data.gateio.co';
use constant API_TRADE => 'https://api.gateio.co';
use constant {
URL_PAIRS => '/api2/1/pairs',
URL_MARKET_INFO => '/api2/1/marketinfo',
Expand Down Expand Up @@ -39,58 +39,58 @@ package GateIO;
has 'secret_key';
has ua => sub { Mojo::UserAgent->new };

# 所有交易对
# 所有交易对
sub pairs {
shift->ua->get(API_QUERY . URL_PAIRS)->res->json;
}

# 市场订单参数
# 市场订单参数
sub market_info {
shift->ua->get(API_QUERY . URL_MARKET_LIST)->res->json;
}

# 交易市场详细行情
# 交易市场详细行情
sub market_list {
shift->ua->get(API_QUERY . URL_MARKET_LIST)->res->json;
}

# 所有交易行情
# 所有交易行情
sub tickers {
shift->ua->get(API_QUERY . URL_TICKERS)->res->json;
}

# 单项交易行情
# 单项交易行情
sub ticker {
my $self = shift;
my $param = shift; # 交易对名称
my $param = shift; # 交易对名称
$self->ua->get(API_QUERY . URL_TICKER . '/' . $param)->res->json;
}

# 所有交易对市场深度
# 所有交易对市场深度
sub order_books {
shift->ua->get(API_QUERY . URL_ORDER_BOOKS)->res->json;
}

# 单项交易对市场深度
# 单项交易对市场深度
sub order_book {
my $self = shift;
my $param = shift; # 交易对名称
my $param = shift; # 交易对名称
$self->ua->get(API_QUERY . URL_ORDER_BOOK . '/' . $param)->res->json;
}

# 历史成交记录
# 历史成交记录
sub trade_history {
my $self = shift;
my $param = shift; # 交易对名称
my $param = shift; # 交易对名称
my $tid = shift;
$param .= "/$tid" if defined $tid and $tid =~ /^\d+$/;
$self->ua->get(API_QUERY . URL_TRADE_HISTORY . '/' . $param)->res->json;
}

# 交易市场K线数据
# 交易市场K线数据
sub candlestick {
my $self = shift;
my $param = shift; # 交易对名称
my $param = shift; # 交易对名称
my $group_sec = shift;
my $rang_hour = shift;

Expand All @@ -101,7 +101,7 @@ sub candlestick {
$self->ua->get(API_QUERY . URL_TRADE_HISTORY . $q)->res->json;
}

# 获取帐号资金余额
# 获取帐号资金余额
sub balances {
my $self = shift;
my $params = {};
Expand Down Expand Up @@ -229,7 +229,7 @@ package main;
use strict;
use Data::Dumper;

# 设置API Key,Secret Key
# 设置API Key,Secret Key
my $api_key = 'your api key';
my $secret_key = 'your secret key';

Expand Down

0 comments on commit 6267009

Please sign in to comment.