Forex API
メジャー、マイナー、エキゾチックを含む 50+ の通貨ペアに Tick レベルの相場情報を提供します。
1 つの WebSocket・REST API で、Tick レベルの Forex、Crypto、Stock、Commodity、Index データを配信します。営業担当との通話なしで、数秒で無料キーを取得できます。
| シンボル | 資産クラス | 価格 | 直近変動 |
|---|---|---|---|
| EUR/USD 外国為替ユーロ / 米ドル | 外国為替 | - | - |
| BTC/USDT 暗号資産ビットコイン | 暗号資産 | - | - |
| ETH/USDT 暗号資産イーサリアム | 暗号資産 | - | - |
| AAPL 株式Apple Inc. | 株式 | - | - |
| XAU/USD コモディティ金スポット | コモディティ | - | - |
| USD/JPY 外国為替米ドル / 円 | 外国為替 | - | - |
| NVDA 株式NVIDIA Corp. | 株式 | - | - |
| SPX 指数S&P 500 指数 | 指数 | - | - |
AllTick がカバーするすべての市場を、同じ統一 REST と WebSocket インターフェースから利用できます。
メジャー、マイナー、エキゾチックを含む 50+ の通貨ペアに Tick レベルの相場情報を提供します。
リアルタイムの現物・デリバティブデータを、1 つの配信に正規化します。
米国、香港、中国本土市場の株式について、約定と相場情報を提供します。
貴金属とエネルギーのリアルタイム価格を提供します。
主要なグローバル指数のベンチマーク値と構成銘柄を提供します。
AllTick の各市場について、対応範囲、レイテンシー、データ種別を比較します。
製品を見るAllTick と一般的な従来型市場データベンダーを比較します。
| 機能 | AllTick | 一般的な従来型ベンダー |
|---|---|---|
| WebSocket レイテンシー中央値 | 約 150ms | 400–800ms |
| 1 つの API に含まれる資産クラス | 5(FX、Crypto、Stock、Commodities、Indices) | 1–2 |
| 稼働率 SLA | 99.95% | 99.5% またはなし |
| 無料枠 | あり — API キーを即時発行 | 営業担当との通話が必要 |
| WebSocket ストリーミング | ネイティブ | ポーリング / 制限あり |
WebSocket に接続し、あらゆる市場の任意のシンボルを購読できます。
# AllTick realtime financial data API
# forex crypto stock commodities indices
import asyncio, json, uuid
import websockets
subscribe = {
"cmd_id": 22004,
"seq_id": 1,
"trace": str(uuid.uuid4()),
"data": {"symbol_list": [{"code": "EURUSD"}]},
}
heartbeat = {"cmd_id": 22000, "seq_id": 1, "trace": "heartbeat", "data": {}}
async def stream():
uri = "wss://quote.alltick.co/quote-b-ws-api?token=YOUR_API_KEY"
async with websockets.connect(uri) as socket:
await socket.send(json.dumps(subscribe))
async def keep_alive():
while True:
await asyncio.sleep(10)
await socket.send(json.dumps(heartbeat))
asyncio.create_task(keep_alive())
async for message in socket:
print(json.loads(message))
asyncio.run(stream())Crypto の対応範囲を広げながら、市場データコストを 60% 削減。
“AllTick への移行により、3 社のベンダーを 1 つの WebSocket 配信に統合し、取引アプリを 1 四半期早くリリースできました。”導入事例を読む
200ms 未満の相場情報更新で 4 万人の同時接続ユーザーに対応。
“99.95% SLA と安定したレイテンシーは、当社のリテールブローカーがグローバル展開するためにまさに必要なものでした。”導入事例を読む
5 資産クラスにわたる 12 年分の Tick データをバックテスト。
“1 つの正規化 API から履歴データとリアルタイムデータを取得でき、数週間分のデータエンジニアリング作業が不要になりました。”導入事例を読む
市場データエンジニアリング、ストリーミング API、低遅延金融アプリケーション構築に関する実践的な記事です。
仮想通貨取引において、クオンツ(量的)戦略は広く議論されているトピックです。取引プロセスを自動化・システム化することで、トレーダーはより効率的に取引を実行し、市場の変動にも素早く対応することができます。この記事では、仮想通貨の文脈における高頻度取引(HFT)戦略を紹介します。
HFTは、超高速な注文執行と買値・売値のスプレッド(差)を利用して利益を得ることを目的としており、仮想通貨の世界でも最も注目されている戦略の一つです。本記事では、いくつかの一般的な高頻度取引戦略を取り上げ、理解と実装を助けるためのコード例も紹介します。
マーケットメイキングは、高頻度取引戦略の一種であり、流動性を提供することで利益を上げることを目的としています。マーケットメイカーは、買い注文と売り注文を同時に出すことで市場の取引を活性化させ、買値と売値のスプレッドから利益を得ます。
マーケットメイキングの核となる考え方は、買い手と売り手の間に立って両サイドの価格を提示し、取引を成立させる「橋渡し」の役割を果たすことです。マーケットメイカーは、流動性を保ち、スプレッドからの利益を最大化するために、注文価格や数量を頻繁に調整します。
主な特徴:
実装ステップ:
import java.util.Random;
public class MarketMakerStrategy {
private double buyPrice;
private double sellPrice;
private double spread;
private double midPrice;
private double minSpread;
private double maxSpread;
private double minQty;
private double maxQty;
private Random random;
public MarketMakerStrategy(double initialBuyPrice, double initialSellPrice, double minSpread, double maxSpread, double minQty, double maxQty) {
this.buyPrice = initialBuyPrice;
this.sellPrice = initialSellPrice;
this.minSpread = minSpread;
this.maxSpread = maxSpread;
this.minQty = minQty;
this.maxQty = maxQty;
this.random = new Random();
updateMidPrice();
updateSpread();
}
private void updateMidPrice() {
midPrice = (buyPrice + sellPrice) / 2;
}
private void updateSpread() {
spread = random.nextDouble() * (maxSpread - minSpread) + minSpread;
}
private double generateQty() {
return random.nextDouble() * (maxQty - minQty) + minQty;
}
public void updateBuyPrice(double newBuyPrice) {
buyPrice = newBuyPrice;
updateMidPrice();
updateSpread();
}
public void updateSellPrice(double newSellPrice) {
sellPrice = newSellPrice;
updateMidPrice();
updateSpread();
}
public void generateBuyOrder() {
double buyQty = generateQty();
double buyOrderPrice = midPrice - spread / 2;
System.out.println("Generated Buy Order - Price: " + buyOrderPrice + ", Quantity: " + buyQty);
}
public void generateSellOrder() {
double sellQty = generateQty();
double sellOrderPrice = midPrice + spread / 2;
System.out.println("Generated Sell Order - Price: " + sellOrderPrice + ", Quantity: " + sellQty);
}
public static void main(String[] args) {
MarketMakerStrategy strategy = new MarketMakerStrategy(100, 102, 0.5, 1.5, 10, 50);
for (int i = 0; i < 10; i++) {
double newBuyPrice = strategy.buyPrice + (strategy.random.nextDouble() - 0.5) * 2;
double newSellPrice = strategy.sellPrice + (strategy.random.nextDouble() - 0.5) * 2;
strategy.updateBuyPrice(newBuyPrice);
strategy.updateSellPrice(newSellPrice);
strategy.generateBuyOrder();
strategy.generateSellOrder();
}
}
}
import random
class MarketMakerStrategy:
def __init__(self, initial_buy_price, initial_sell_price, min_spread, max_spread, min_qty, max_qty):
self.buy_price = initial_buy_price
self.sell_price = initial_sell_price
self.min_spread = min_spread
self.max_spread = max_spread
self.min_qty = min_qty
self.max_qty = max_qty
self.random = random.Random()
self.mid_price = (self.buy_price + self.sell_price) / 2
self.spread = self.random.uniform(self.min_spread, self.max_spread)
def update_prices(self, new_buy_price, new_sell_price):
self.buy_price = new_buy_price
self.sell_price = new_sell_price
self.mid_price = (self.buy_price + self.sell_price) / 2
self.spread = self.random.uniform(self.min_spread, self.max_spread)
def generate_buy_order(self):
buy_qty = self.random.uniform(self.min_qty, self.max_qty)
buy_order_price = self.mid_price - self.spread / 2
print(f"Generated Buy Order - Price: {buy_order_price}, Quantity: {buy_qty}")
def generate_sell_order(self):
sell_qty = self.random.uniform(self.min_qty, self.max_qty)
sell_order_price = self.mid_price + self.spread / 2
print(f"Generated Sell Order - Price: {sell_order_price}, Quantity: {sell_qty}")
strategy = MarketMakerStrategy(100, 102, 0.5, 1.5, 10, 50)
for i in range(10):
new_buy_price = strategy.buy_price + (strategy.random.random() - 0.5) * 2
new_sell_price = strategy.sell_price + (strategy.random.random() - 0.5) * 2
strategy.update_prices(new_buy_price, new_sell_price)
strategy.generate_buy_order()
strategy.generate_sell_order()
アービトラージ取引とは、異なる取引所や通貨ペア間の価格差を利用して利益を得る手法です。仮想通貨市場では、複数の取引所間で価格にばらつきが生じることがよくあり、この差を利用して「安く買って高く売る」ことが可能です。
実装ステップ:
実行プロセス:
import java.util.HashMap;
import java.util.Map;
public class ArbitrageTradingStrategy {
private Map<String, Double> exchangeA;
private Map<String, Double> exchangeB;
public ArbitrageTradingStrategy() {
this.exchangeA = new HashMap<>();
this.exchangeB = new HashMap<>();
exchangeA.put("BTC", 10000.0);
exchangeA.put("ETH", 500.0);
exchangeB.put("BTC", 10100.0);
exchangeB.put("ETH", 510.0);
}
public void executeArbitrage() {
for (String currency : exchangeA.keySet()) {
if (exchangeB.containsKey(currency)) {
double priceDifference = exchangeB.get(currency) - exchangeA.get(currency);
if (priceDifference > 0) {
System.out.println("Arbitrage Opportunity: Buy " + currency + " on Exchange A, Sell on Exchange B. Profit: " + priceDifference);
}
}
}
}
public static void main(String[] args) {
ArbitrageTradingStrategy strategy = new ArbitrageTradingStrategy();
strategy.executeArbitrage();
}
}
import java.util.HashMap;
import java.util.Map;
public class ArbitrageTradingStrategy {
private Map<String, Double> exchangeA;
private Map<String, Double> exchangeB;
public ArbitrageTradingStrategy() {
this.exchangeA = new HashMap<>();
this.exchangeB = new HashMap<>();
exchangeA.put("BTC", 10000.0);
exchangeA.put("ETH", 500.0);
exchangeB.put("BTC", 10100.0);
exchangeB.put("ETH", 510.0);
}
public void executeArbitrage() {
for (String currency : exchangeA.keySet()) {
if (exchangeB.containsKey(currency)) {
double priceDifference = exchangeB.get(currency) - exchangeA.get(currency);
if (priceDifference > 0) {
System.out.println("Arbitrage Opportunity: Buy " + currency + " on Exchange A, Sell on Exchange B. Profit: " + priceDifference);
}
}
}
}
public static void main(String[] args) {
ArbitrageTradingStrategy strategy = new ArbitrageTradingStrategy();
strategy.executeArbitrage();
}
}
アービトラージ取引戦略クラス(ArbitrageTradingStrategy)では、2つの取引所における価格データを初期化し、execute_arbitrage メソッドを用いて利益の出るアービトラージ機会があるかどうかをチェックします。
板情報のアンバランス監視とは、買い注文と売り注文の量を監視し、その不均衡に基づいて売買を行う戦略です。たとえば、買い注文が売り注文を大きく上回っている場合、価格の上昇が予測されるため、買い注文を出す判断材料となります。
import java.util.Random;
public class OrderBookImbalanceTrackingStrategy {
private double buyOrders;
private double sellOrders;
private double imbalanceThreshold;
private Random random;
public OrderBookImbalanceTrackingStrategy(double imbalanceThreshold) {
this.imbalanceThreshold = imbalanceThreshold;
this.random = new Random();
this.buyOrders = random.nextDouble() * 100;
this.sellOrders = random.nextDouble() * 100;
}
public void updateOrderBook() {
this.buyOrders = random.nextDouble() * 100;
this.sellOrders = random.nextDouble() * 100;
checkImbalance();
}
private void checkImbalance() {
if (buyOrders > sellOrders + imbalanceThreshold) {
System.out.println("Imbalance detected: Buy orders significantly higher than sell orders. Execute buy trade.");
} else if (sellOrders > buyOrders + imbalanceThreshold) {
System.out.println("Imbalance detected: Sell orders significantly higher than buy orders. Execute sell trade.");
} else {
System.out.println("Order book is balanced. No trade execution needed.");
}
}
public static void main(String[] args) {
OrderBookImbalanceTrackingStrategy strategy = new OrderBookImbalanceTrackingStrategy(10);
for (int i = 0; i < 5; i++) {
strategy.updateOrderBook();
}
}
}
実装ステップ:
updateOrderBook メソッドを使用して板情報の更新をシミュレートします。実際の取引では、取引所のAPIやWebSocketなどからデータを取得します。checkImbalance メソッドにより、買い注文と売り注文のボリュームを比較します。買い注文が大きく上回っていれば「買い」シグナル、逆に売り注文が多ければ「売り」シグナルとなります。import random
class OrderBookImbalanceTrackingStrategy:
def __init__(self, imbalance_threshold):
self.imbalance_threshold = imbalance_threshold
self.random = random.Random()
self.buy_orders = self.random.uniform(50, 100)
self.sell_orders = self.random.uniform(50, 100)
def update_order_book(self):
self.buy_orders = self.random.uniform(50, 100)
self.sell_orders = self.random.uniform(50, 100)
self.check_imbalance()
def check_imbalance(self):
if self.buy_orders > self.sell_orders + self.imbalance_threshold:
print("Imbalance detected: Buy orders significantly higher than sell orders. Execute buy trade.")
elif self.sell_orders > self.buy_orders + self.imbalance_threshold:
print("Imbalance detected: Sell orders significantly higher than buy orders. Execute sell trade.")
else:
print("Order book is balanced. No trade execution needed.")
strategy = OrderBookImbalanceTrackingStrategy(10)
for i in range(5):
strategy.update_order_book()
この戦略では、移動平均(MA)や相対力指数(RSI)などのテクニカル指標を用いて価格パターンを特定し、取引の意思決定を行います。これらの指標に急激な変化が見られた場合、迅速な売買を行うきっかけとなります。
実装ステップ:
public class TechnicalIndicatorTradingStrategy {
private double[] priceData;
private int windowSize;
private double[] movingAverage;
private double[] rsi;
public TechnicalIndicatorTradingStrategy(double[] priceData, int windowSize) {
this.priceData = priceData;
this.windowSize = windowSize;
this.movingAverage = calculateMovingAverage();
this.rsi = calculateRSI();
}
private double[] calculateMovingAverage() {
double[] ma = new double[priceData.length - windowSize + 1];
for (int i = 0; i < ma.length; i++) {
double sum = 0;
for (int j = i; j < i + windowSize; j++) {
sum += priceData[j];
}
ma[i] = sum / windowSize;
}
return ma;
}
private double[] calculateRSI() {
double[] rsi = new double[priceData.length - windowSize + 1];
double[] priceChange = new double[priceData.length - 1];
for (int i = 0; i < priceChange.length; i++) {
priceChange[i] = priceData[i + 1] - priceData[i];
}
for (int i = 0; i < rsi.length; i++) {
double sumGain = 0, sumLoss = 0;
for (int j = i; j < i + windowSize; j++) {
if (priceChange[j] > 0) {
sumGain += priceChange[j];
} else {
sumLoss -= priceChange[j];
}
}
double avgGain = sumGain / windowSize;
double avgLoss = sumLoss / windowSize;
double rs = avgGain / avgLoss;
rsi[i] = 100 - (100 / (1 + rs));
}
return rsi;
}
public void executeStrategy() {
}
public static void main(String[] args) {
double[] priceData = {100, 105, 110, 115, 120, 115, 110, 105, 100};
int windowSize = 3;
TechnicalIndicatorTradingStrategy strategy = new TechnicalIndicatorTradingStrategy(priceData, windowSize);
strategy.executeStrategy();
}
}
import numpy as np
class TechnicalIndicatorTradingStrategy:
def __init__(self, price_data, window_size):
self.price_data = price_data
self.window_size = window_size
self.moving_average = self.calculate_moving_average()
self.rsi = self.calculate_rsi()
def calculate_moving_average(self):
moving_average = np.convolve(self.price_data, np.ones(self.window_size) / self.window_size, mode='valid')
return moving_average
def calculate_rsi(self):
deltas = np.diff(self.price_data)
gain = deltas.copy()
loss = deltas.copy()
gain[gain < 0] = 0
loss[loss > 0] = 0
avg_gain = np.mean(gain[:self.window_size])
avg_loss = -np.mean(loss[:self.window_size])
rsi = np.zeros_like(self.price_data)
rsi[:self.window_size] = 100. - 100. / (1. + avg_gain / avg_loss)
for i in range(self.window_size, len(self.price_data)):
delta = deltas[i - 1] # price change
gain_value = max(0, delta)
loss_value = -min(0, delta)
avg_gain = (avg_gain * (self.window_size - 1) + gain_value) / self.window_size
avg_loss = (avg_loss * (self.window_size - 1) + loss_value) / self.window_size
rs = avg_gain / avg_loss
rsi[i] = 100. - 100. / (1. + rs)
return rsi
def execute_strategy(self):
pass
price_data = np.array([100, 105, 110, 115, 120, 115, 110, 105, 100])
window_size = 3
strategy = TechnicalIndicatorTradingStrategy(price_data, window_size)
strategy.execute_strategy()