Skip to content

Commit

Permalink
deploy: 474540e
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Jan 25, 2024
1 parent 2f3ee17 commit 40e95c1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2573,14 +2573,14 @@ <h2 id='dlob-source-usermap'>Dlob Source - <code>UserMap</code></h2>
<span class="kn">from</span> <span class="nn">driftpy.user_map.user_map</span> <span class="kn">import</span> <span class="n">UserMap</span>
<span class="kn">from</span> <span class="nn">driftpy.user_map.user_map_config</span> <span class="kn">import</span> <span class="n">UserMapConfig</span><span class="p">,</span> <span class="n">WebsocketConfig</span>

<span class="n">connection</span> <span class="o">=</span> <span class="n">AsyncClient</span><span class="p">(</span><span class="s">"https://api.mainnet-beta.solana/com"</span><span class="p">)</span>

<span class="n">keypair_file</span> <span class="o">=</span> <span class="s">"~/.config/solana/my-keypair.json"</span>

<span class="n">connection</span> <span class="o">=</span> <span class="n">AsyncClient</span><span class="p">(</span><span class="s">"https://api.mainnet-beta.solana.com"</span><span class="p">)</span> <span class="c1"># switch for your own rpc
</span>
<span class="n">keypair_file</span> <span class="o">=</span> <span class="s">""</span> <span class="c1"># path to keypair file
</span>
<span class="n">wallet</span> <span class="o">=</span> <span class="n">Wallet</span><span class="p">(</span><span class="n">load_keypair</span><span class="p">(</span><span class="n">keypair_file</span><span class="p">))</span>

<span class="n">drift_client</span> <span class="o">=</span> <span class="n">DriftClient</span><span class="p">(</span>
<span class="n">connnection</span><span class="p">,</span>
<span class="n">connection</span><span class="p">,</span>
<span class="n">wallet</span><span class="p">,</span>
<span class="s">"mainnet"</span>
<span class="p">)</span>
Expand Down Expand Up @@ -2678,8 +2678,11 @@ <h2 id='dlob-source-usermap'>Dlob Source - <code>UserMap</code></h2>
</tbody></table>
<div class="highlight"><pre class="highlight python tab-python"><code><span class="kn">from</span> <span class="nn">driftpy.dlob.dlob_subscriber</span> <span class="kn">import</span> <span class="n">DLOBSubscriber</span>
<span class="kn">from</span> <span class="nn">driftpy.dlob.client_types</span> <span class="kn">import</span> <span class="n">DLOBClientConfig</span>
<span class="kn">from</span> <span class="nn">driftpy.slot.slot_subscriber</span> <span class="kn">import</span> <span class="n">SlotSubscriber</span>

<span class="n">slot_subscriber</span> <span class="o">=</span> <span class="n">SlotSubscriber</span><span class="p">(</span><span class="n">drift_client</span><span class="p">)</span>

<span class="n">config</span> <span class="o">=</span> <span class="n">DLOBClientConfig</span><span class="p">(</span><span class="n">drift_client</span><span class="p">,</span> <span class="n">user_map</span><span class="p">,</span> <span class="n">slot_subscriber</span><span class="p">,</span> <span class="mi">1_000</span><span class="p">)</span>
<span class="n">config</span> <span class="o">=</span> <span class="n">DLOBClientConfig</span><span class="p">(</span><span class="n">drift_client</span><span class="p">,</span> <span class="n">user_map</span><span class="p">,</span> <span class="n">slot_subscriber</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">dlob_subscriber</span> <span class="o">=</span> <span class="n">DLOBSubscriber</span><span class="p">(</span><span class="n">config</span> <span class="o">=</span> <span class="n">config</span><span class="p">)</span>

<span class="k">await</span> <span class="n">dlob_subscriber</span><span class="p">.</span><span class="n">subscribe</span><span class="p">()</span>
Expand Down

0 comments on commit 40e95c1

Please sign in to comment.