@hashflow/market-maker
v0.0.15
Published
Javascript library to facilitate interactions with Hashflow backend and smart contracts for market makers
Downloads
37
Readme
maker-js
Typescript library which exposes the hashflow market maker APIs
HashflowMaker
All necessary functions are exposed through the HashflowMaker
object. This API object takes the following arguments to its constructor:
- name: Your market maker's name. This must match the name that used when requesting the Hashflow team to add your market maker to the allowlist.
- authKey: Your authentication key. These are unique keys generated by the Hashflow team during the vetting phase. If you haven't gone through this process, you can contact us on Discord.
- engine: An instance of
MakerEngine
which defines the configuration, pricing strategy, and callback to handle trade confirmation. See next section. - secp256k1Signer: A function which takes a UInt8Array, signs it with your key, and returns a signature and recid.
- environment (optional): Allows specifying
'staging'
for connecting to the non-production API. By default, this is set to'production'
. - makerIndex (optional): Allows specifying an index for your maker.
- levelsUpdateRatePerSecond (optional) The rate at which to update price levels.
- logger (optiona) A
WinstonLogger
for log messages. - apiUrl (optional) The Websocket API URL to connect to.
Once the HashflowMaker
has been constructed, it will connect to the API, publish price levels, and
respond to RFQs.
MakerEngine
You must provide a MakerEngine
instance operate the maker. See the jsDoc in the MakerEngine
interface definition and the tests in HashflowMaker.test.ts
for details on how to build your MakerEngine
.
Quote Hashing
We also expose quote hashing functionality directly, so you can use that within your own API client. The function
getQuoteHash
, given an RFQ and an unsigned Quote, will return the hash which must be signed with SECP256K1 to
create the quote signature.