jiyi
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 造市策略 [TOC] ### `美元匯率`取法 分別為以下兩種: 1. Bitopro 的 `USDT_TWD` 站內 `買一價`、`賣一價`。 優點:`spread` 小,最貼近 Bitopro 行情。 缺點:美元匯損風險高。 ```python= bid = bid_usdt_twd - offset ask = ask_usdt_twd + offset # where offset = 0.005 ``` 2. Bitopro 的 `USDT_TWD` 站內 `買一價`、`賣一價` 與 台灣銀行的 USDTWD 報價比較: 優點:美元匯損風險小。 缺點:`spread` 大,未貼近 Bitopro 行情。 ```python= bid = min(bitopro_bid, bank_of_taiwan_bid) ask = max(bitopro_ask, bank_of_taiwan_ask) ``` ### 埋深度策略(golduck) --- 如果`quote`是 `USDT`: Bitopro `買一價`與 站外`買一價`,選最小。 Bitopro `賣一價`與 站外`賣一價`,選最大。 ```python= bid = min(bid_bitopro, bid_exchange) ask = max(ask_bitopro, ask_exchange) ``` 如果`quote`是 `TWD`, 則採以下作法 ```python= bid = min(bid_bitopro, bid_exchange * bid_usdt) ask = max(ask_bitopro, ask_exchange * ask_usdt) ``` 要掛的 `買一價`、`賣一價` (+-**10%**) ```python= bid = bid / (1 + bid_shift_ratio) ask = ask * (1 + ask_shift_ratio) # where bid_shift_ratio = 0.1 ask_shift_ratio = 0.1 ``` bid, ask 掛單各10單的價格 ```python= ask_price = [ask_price_ref * (1 + (i * ask_interval))) for i in range(10)] bid_price = [bid_price_ref / (1 + (i * bid_interval))) for i in range(10)] # where bid_interval = 0.015 ask_interval = 0.015 ``` 如果有成交,**顆數沖銷**反掛價格為 ```python= adk_price = bid_price_max * (1 + bid_shift_ratio * (1 - rebate_ratio)) bid_price = ask_price_min / (1 + ask_shift_ratio * (1 - rebate_ratio)) # where bid_shift_ratio = 0.1 ask_shift_ratio = 0.1 rebate_ratio = 0.3 ``` 埋深度策略(golduck)優缺點分析: **pros:** * 如果有出現插針情況,會被`避雷針`吸收,即 `golduck` 策略,以及這種情況如果反掛回去,容易被成交(沖銷)。**(即賺一波的意思)** **cons:** * 需要長期放一筆資金在 Bitopro 掛單簿中後段的價位,要很久很久才有機會成交,資金無法有效利用。相當於`做保險`用的。 ### 一般策略(psyduck) --- 取兩間站外價格加權平均,`買一價`、`賣一價`,**不平移**,掛到 Bitopro. 如果`quote`是 `USDT`: ```PYTHO= # 以MV為例 bids = 0.75 * bid_bybit + 0.25 * bid_kucoin asks = 0.75 * ask_bybit + 0.25 * ask_kucoin ``` 如果`quote`是 `TWD`, 則採以下作法 ```python= # 以MV為例 bids = (0.75 * bid_bybit + 0.25 * bid_kucoin) * bid_usdt_twd asks = (0.75 * ask_bybit + 0.25 * ask_kucoin) * ask_usdt_twd ``` bid, ask 掛單各10單的價格 ```python= ask_price = [ask_price_ref * (1 + (i * ask_interval))) for i in range(10)] bid_price = [bid_price_ref / (1 + (i * bid_interval))) for i in range(10)] # where bid_interval = 0.01 ask_interval = 0.01 ``` **註:** 1. Bitopro成交常出現單邊行情,也就是這段期間僅有買(賣)單成交,所以如果我們的掛單有成交,`psyduck` 策略為不反掛。不然,未成交的掛單會越來越多。 2. 波動率: 取現貨價格,離現在時間最近的1分K兩根,兩根的絕對值取最大。 如果有指數價格則也會取離現在時間最近的1分K兩根,4根的絕對值取最大。 波動率計算如下: ```python= if close - open >= 0: [0.786151 * (close - open) + 0.213849 * (high -low)] / open else: [0.786151 * (open - close) + 0.213849 * (high -low)] / open ``` 3. 波動率在`psyduck`係用來判斷是否下單的條件。以 `MV` 為例,波動率大於或等於0.01 (1%),即不掛單。這個動作是在撤單後做,所以不掛單的情況,不會有殘留之前的單。 psyduck 優缺點分析 **pros:** * 貼近站外市場行情,因為不平移,掛在 `Bitopro` 的 `spread` 也可以比較小。 * 此為在 `Bitopro` 掛單簿呈現上,有**深度**也有較小 `spread` 的**最佳造市策略**。 **cons:** * 無避險。如果有成交,所付出的成本較高。在幣價下跌或單邊行情下有可能虧損。 ### 刷交易量策略(imduck) --- * 一般模式為拿出1成資金,再乘上一個 (0,1] 的隨機數,做刷交易量的策略。 * 策略為在`買一價`、`賣一價`的區間,建立買單10筆,賣單10筆,共20筆。將20筆單做多次 `shuffle`後,一次下兩單,每次間隔1~5秒, * 無成交的單,會在掛單簿停留一陣子後,再刪掉。此舉可縮小 `spread`。 * 每次策略間隔為1800~3600秒。 * 夜間模式(晚上10點至隔天早上8點):策略間隔為3600~9000秒。使用1成資金,乘上0.33,再乘上一個 (0,1] 的隨機數做為策略使用。 imduck 優缺點分析 **pros:** * k線好看,一天下來,有不錯的交易量。用戶會認為這個交易對有持續在交易。 **cons:** * 無避險。如果有其他用戶跟我們成交,我們所付出的成本較高。 ### 站外拋捕策略(chinchou) --- * 此為最複雜的策略,開發時程長,需要資金也最多的策略。 策略: * 取站外`bid`, `ask` 各前5檔價格,此前5檔的每一檔都有經過到達一定的顆數才取的價格。 * 經過`波動率`的平移,再經過**至少**`站外手續費`的平移後,才會掛到 Bitopro 的掛單簿上。 * 站外的 bid,掛到 Bitopro 的 bid;站外的 ask,掛到 Bitopro 的 ask。 * 在 Bitopro 掛個2~3秒,如果有成交,則以平均成交價格在站外反掛。 chinchou 優缺點分析 **pros:** * 優點為**幾近**`無風險套利`,也就是理論上是無風險套利,但實務上因為價格瞬息萬變而產生獲利不確定性。 **cons:** * 在`Bitopro`掛單簿的呈現無法一定是掛在前幾檔。 * 每次套利的利潤都極小,一次套利失敗造成的虧損,有可能把之前多次的利潤都吃掉。 * 策略細節很複雜,開發時程很長。 * 需要資金非常多。 * 價格瞬息萬變,掛單時間僅掛個幾秒就必須刪單。 * 必須滿足: 1. **Bitopro價格**與**站外價格**有明顯價差。 2. 站外手續費要夠便宜。 3. 滿足以上二條件,才有可能在 Bitopro 的 bid (或 ask,二者其一) 掛在前幾檔,或立即成交吃單。無法**同時成立** bid, ask 都掛前幾檔。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully