Skip to content

Commit

Permalink
deploy: 1f3b1e7
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Nov 27, 2023
1 parent aa4cb34 commit c97afe8
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,8 @@ <h2 id='withdrawing'>Withdrawing</h2><div class="highlight"><pre class="highligh
<span class="nx">associatedTokenAccount</span><span class="p">,</span>
<span class="p">);</span>
</code></pre></div><div class="highlight"><pre class="highlight python tab-python"><code>
<span class="n">spot_market_index</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># USDC
</span><span class="n">amount</span> <span class="o">=</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">convert_to_spot_precision</span><span class="p">(</span><span class="n">spot_market_index</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span> <span class="c1"># $100
<span class="n">market_index</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># USDC
</span><span class="n">amount</span> <span class="o">=</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">convert_to_spot_precision</span><span class="p">(</span><span class="n">market_index</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span> <span class="c1"># $100
</span>
<span class="n">tx_sig</span> <span class="o">=</span> <span class="k">await</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">withdraw</span><span class="p">(</span><span class="n">amount</span><span class="p">,</span> <span class="n">spot_market_index</span><span class="p">)</span>
</code></pre></div>
Expand Down Expand Up @@ -972,6 +972,17 @@ <h2 id='transferring-deposits'>Transferring Deposits</h2><div class="highlight">
<span class="nx">fromSubAccountId</span><span class="p">,</span>
<span class="nx">toSubAccountId</span><span class="p">,</span>
<span class="p">);</span>
</code></pre></div><div class="highlight"><pre class="highlight python tab-python"><code><span class="n">market_index</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">amount</span> <span class="o">=</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">convert_to_spot_precision</span><span class="p">(</span><span class="n">market_ndex</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="n">from_sub_account_id</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">to_sub_account_id</span> <span class="o">=</span> <span class="mi">0</span>

<span class="k">await</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">transfer_deposit</span><span class="p">(</span>
<span class="n">amount</span><span class="p">,</span>
<span class="n">market_index</span><span class="p">,</span>
<span class="n">from_sub_account_id</span><span class="p">,</span>
<span class="n">to_sub_account_id</span><span class="p">,</span>
<span class="p">)</span>
</code></pre></div>
<table><thead>
<tr>
Expand Down Expand Up @@ -1644,6 +1655,13 @@ <h2 id='settle-perp-pnl'>Settle Perp PNL</h2><div class="highlight"><pre class="
<span class="nx">user</span><span class="p">.</span><span class="nx">getUserAccount</span><span class="p">(),</span>
<span class="nx">marketIndex</span>
<span class="p">);</span>
</code></pre></div><div class="highlight"><pre class="highlight python tab-python"><code><span class="n">market_index</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">user</span> <span class="o">=</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">get_user</span><span class="p">()</span>
<span class="k">await</span> <span class="n">drift_client</span><span class="p">.</span><span class="n">settle_pnl</span><span class="p">(</span>
<span class="n">user</span><span class="p">.</span><span class="n">user_public_key</span><span class="p">,</span>
<span class="n">user</span><span class="p">.</span><span class="n">get_user_account</span><span class="p">(),</span>
<span class="n">market_index</span>
<span class="p">)</span>
</code></pre></div>
<table><thead>
<tr>
Expand Down

0 comments on commit c97afe8

Please sign in to comment.