All Projects → MixinNetwork → Ocean.one

MixinNetwork / Ocean.one

Licence: apache-2.0
🌊 Ocean ONE is a decentralized exchange built on Mixin Network

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Ocean.one

Contracts
[DEPRECATED] 0x smart contracts and tests.
Stars: ✭ 317 (+80.11%)
Mutual labels:  blockchain, exchange
Achain
Achain blockchain
Stars: ✭ 178 (+1.14%)
Mutual labels:  blockchain, exchange
Akash
a secure, transparent, and peer-to-peer cloud computing network
Stars: ✭ 229 (+30.11%)
Mutual labels:  blockchain, exchange
Exchangesharp
ExchangeSharp is a powerful, fast and easy to use .NET/C# API for interfacing with many crypto currency exchanges. REST and web sockets are supported.
Stars: ✭ 489 (+177.84%)
Mutual labels:  blockchain, exchange
Awesome Blockchain
Curated list of blockchain services and exchanges 🔥🏦🔥🏦🔥🏦🔥
Stars: ✭ 604 (+243.18%)
Mutual labels:  blockchain, exchange
Dex Protocols
A list of protocols for decentralized exchange
Stars: ✭ 109 (-38.07%)
Mutual labels:  blockchain, exchange
Whale
🐋 Show Ethereum and Bitcoin price in command line interface (CLI).
Stars: ✭ 81 (-53.98%)
Mutual labels:  blockchain, exchange
My Token
📈Track token prices of your favorite exchanges in terminal!
Stars: ✭ 141 (-19.89%)
Mutual labels:  blockchain, exchange
Smart Contract Watch
A tool to monitor a number of smart contracts and transactions
Stars: ✭ 168 (-4.55%)
Mutual labels:  blockchain
996.blockchain
Blockchain for the 996 evidence
Stars: ✭ 172 (-2.27%)
Mutual labels:  blockchain
Cicero
Accord Project Smart Templates Implementation
Stars: ✭ 166 (-5.68%)
Mutual labels:  blockchain
Dashboard
Stars: ✭ 168 (-4.55%)
Mutual labels:  blockchain
Study Blockchain Referrence
区块链学习路上的一些资料作为参考
Stars: ✭ 172 (-2.27%)
Mutual labels:  blockchain
Cash Cli
💰💰 Convert currency rates directly from your terminal!
Stars: ✭ 168 (-4.55%)
Mutual labels:  exchange
Eos Bios
DEPRECATED: use `eosc boot` now. Historically: Orchestrator for a decentralized EOS.IO blockchain network boot
Stars: ✭ 173 (-1.7%)
Mutual labels:  blockchain
Mastering Ethereum
分散アプリケーションプラットフォーム「ethereum」の入門書
Stars: ✭ 165 (-6.25%)
Mutual labels:  blockchain
Toshi Android Client
Android client for Toshi
Stars: ✭ 167 (-5.11%)
Mutual labels:  blockchain
Eevm
Enclave ready EVM (eEVM) is an open-source, standalone, embeddable, C++ implementation of the Ethereum Virtual Machine.
Stars: ✭ 175 (-0.57%)
Mutual labels:  blockchain
Dcrwallet
A secure Decred wallet daemon written in Go (golang).
Stars: ✭ 172 (-2.27%)
Mutual labels:  blockchain
Okexchain
⛓️ The Infrastructure of Decentralized Exchange ✨
Stars: ✭ 171 (-2.84%)
Mutual labels:  blockchain

Ocean ONE

Ocean ONE is a decentralized exchange built on Mixin Network, it's almost the first time that a decentralized exchange gain the same user experience as a centralized one.

Ocean ONE accepts all assets in Mixin Network as base currencies, and the only supported quote currencies are Mixin XIN (c94ac88f-4671-3976-b60a-09064f1811e8), Bitcoin BTC (c6d0c728-2624-429b-8e0d-d9d19b6592fa) and Omni USDT (815b0b1a-2764-3736-8faa-42d694fa620a).

All order and trade data are encoded in the Mixin snapshots' memo field, the memo is base64 encoded MessagePack.

Create Order

To sell 0.7 XIN with price 0.1 BTC/XIN, send a 0.7 XIN transfer to Ocean ONE with base64 encoded MessagePack data as the memo.

type OrderAction struct {
  S string    // side
  A uuid.UUID // asset
  P string    // price
  T string    // type
  O uuid.UUID // order
}

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
  T: "L",
  P: "0.1",
  S: "A",
  A: uuid.FromString("c6d0c728-2624-429b-8e0d-d9d19b6592fa"),
}))

To buy some XIN with price 0.1 BTC/XIN, send the desired amount of BTC transfer to Ocean ONE with base64 encoded MessagePack data as the memo.

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
  T: "L",
  P: "0.1",
  S: "B",
  A: uuid.FromString("c94ac88f-4671-3976-b60a-09064f1811e8"),
}))

It's recommended to set the trace_id field whenever you send a transfer to Ocean ONE, the trace_id will be used as the order id.

Cancel Order

Send any amount of any asset to Ocean ONE with base64 encoded MessagePack data as the memo.

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
  O: uuid.FromString("2497b2bb-4d67-49bf-b2bc-211b0543d7ac"),
}))

Bid Order Behavior

A bid order, despite a limit bid order or market bid order, will transfer some quote funds to the matching engine. Ocean ONE engine will match all the funds, this is a typical behavior for market order. However for a limit bid order, user may expect the order done whenever the desired bid size filled, in this situation, Ocean ONE engine still matches all the funds which may result in a larger order size filled.

Events

The order book and all matches are always available in the Mixin Network snapshots, and Ocean ONE offers a WebSocket layer to provide a convenient query interface.

The WebSocket endipoint is wss://events.ocean.one, and all messages sent and received should be gziped. The event message is in a standard format.

{
  "id": "a3fb2c7d-88ed-4605-977c-ebbb3f32ad71",
  "action": "EMIT_EVENT",
  "params": {},
  "data": {},
  "error": "description"
}

The params field is for the client sent message. The data or error is for the server message, and only one of them will be present in the message. If the message is the server response of a message from the client, the id and action fields will be identical to the sent one.

Whenever a client connects to the events server, it must send a SUBSCRIBE_BOOK message to the server, otherwise the client won't receive any events messages.

{
  "id": "a3fb2c7d-88ed-4605-977c-ebbb3f32ad71",
  "action": "SUBSCRIBE_BOOK",
  "params": {
    "market": "c94ac88f-4671-3976-b60a-09064f1811e8-c6d0c728-2624-429b-8e0d-d9d19b6592fa"
  }
}

This will subscibe the client to all the events of the specific market in the params. To unsubscribe, send a similar message but with the action UNSUBSCRIBE_BOOK. A client can always subscribe to many markets with many different SUBSCRIBE_BOOK messages.

BOOK-T0

This is the first event whenever a client subscribe to a specific market, the event contains the full order book of the market.

{
  "id": "a3fb2c7d-88ed-4605-977c-ebbb3f32ad71",
  "action": "EMIT_EVENT",
  "data": {
    "market": "c94ac88f-4671-3976-b60a-09064f1811e8-c6d0c728-2624-429b-8e0d-d9d19b6592fa",
    "sequence": 1531142594,
    "event": "BOOK-T0",
    "data": {
      "asks": [],
      "bids": []
    }
  }
}

ORDER-OPEN

The order is now open on the order book. This message will only be sent for orders which are not fully filled immediately. amount will indicate how much of the order is unfilled and going on the book.

ORDER-MATCH

A trade occurred between two orders. The taker order is the one executing immediately after being received and the maker order is a resting order on the book. The side field indicates the maker order side. If the side is ask this indicates the maker was a sell order and the match is considered an up-tick. A bid side match is a down-tick.

ORDER-CANCEL

The order is cancelled and no longer on the order book, amount indicates how much of the order went unfilled.

List Orders

List orders of the authenticated user. The authentication is ECDSA JWT based, and the user needs to register a ECDSA public key to Ocean ONE with base64 encoded MessagePack data as the memo.

memo = base64.StdEncoding.EncodeToString(msgpack(OrderAction{
  U: RAW BYTES OF THE ECDSA PUBLIC KEY,
}))

To authenticate, create the JWT payload with user id as uid and sign it with the ECDSA private key. Then pass the token as a HTTP Bearer Authorization header.

Make a HTTP GET request to https://events.ocean.one/orders to retrieve orders, and the available query params are market, state, limit and offset.

Market Data

The market data API is an unauthenticated set of endpoints for retrieving market data. These endpoints provide snapshots of market data.

Ticker

Snapshot information about the last trade (tick), best bid/ask.

GET https://events.ocean.one/markets/:id/ticker

{
  "trade_id": "bf1bf64b-9ba6-4961-9ca8-38ea8358b9f3"
  "amount": "0.001",
  "price": "0.2",
  "ask": "0.2",
  "bid": "0.1",
  "sequence": 1531305918,
  "timestamp": "2018-07-12T05:51:30.757002284Z",
}

Order Book

Get the full list of open orders for a market, the list is not udpated in real time, for the most up-to-date data, consider using the websocket stream.

GET https://events.ocean.one/markets/:id/book

{
  "market": "c94ac88f-4671-3976-b60a-09064f1811e8-c6d0c728-2624-429b-8e0d-d9d19b6592fa",
  "event": "BOOK-T0",
  "sequence": 1531305926,
  "data": {
    "asks": [
      {
        "amount": "0.999",
        "funds": "0.1998",
        "price": "0.2",
        "side": "ASK"
      }
    ],
    "bids": [
      {
        "amount": "0.52",
        "funds": "0.052",
        "price": "0.1",
        "side": "BID"
      }
    ]
  },
  "timestamp": "2018-07-12T05:55:44.757025182Z"
}

Trades

List the trades history for a market. Available query params are market, state, limit and offset.

GET https://events.ocean.one/markets/:id/trades

[
  {
    "amount": "0.001",
    "base": "c94ac88f-4671-3976-b60a-09064f1811e8",
    "created_at": "2018-07-11T08:02:44.094160294Z",
    "price": "0.2",
    "quote": "c6d0c728-2624-429b-8e0d-d9d19b6592fa",
    "side": "ASK",
    "trade_id": "bf1bf64b-9ba6-4961-9ca8-38ea8358b9f3"
  }
]

Fee

  • Taker: 0.1%
  • Maker: 0.0%

References

Join the Team

Please contact Mixin 25566

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].