Skip to content

Commit 7bcff51

Browse files
committed
Enhance API documentation with detailed method descriptions and improve styling for code blocks
1 parent 4070a91 commit 7bcff51

File tree

2 files changed

+76
-69
lines changed

2 files changed

+76
-69
lines changed

docs/api.html

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,61 @@ <h1>PocketOptionAPI Async</h1>
2121
<main>
2222
<h2>API Reference</h2>
2323
<div class="card">
24-
<h3>AsyncPocketOptionClient</h3>
25-
<ul>
26-
<li><b>AsyncPocketOptionClient(ssid, is_demo=True, enable_logging=True, ...)</b><br>
27-
<span style="color:#a78bfa">Create a new async client for Pocket Option.</span></p>
28-
<pre><code>from pocketoptionapi_async import AsyncPocketOptionClient
24+
<h3>Class: AsyncPocketOptionClient</h3>
25+
<p><b>AsyncPocketOptionClient(ssid, is_demo=True, enable_logging=True, ...)</b></p>
26+
<p>Creates a new asynchronous client for Pocket Option. This is the main entry point for all API operations.</p>
27+
<pre><code>from pocketoptionapi_async import AsyncPocketOptionClient
2928
client = AsyncPocketOptionClient("SSID", is_demo=True, enable_logging=True)
3029
</code></pre>
31-
<ul>
32-
<li><b>ssid</b> (str): Your Pocket Option SSID cookie value (required)</li>
33-
<li><b>is_demo</b> (bool): Use demo account if True, real if False (default: True)</li>
34-
<li><b>enable_logging</b> (bool): Enable logging output (default: True)</li>
35-
</ul>
30+
<ul>
31+
<li><b>ssid</b> (str): Your Pocket Option SSID cookie value (required)</li>
32+
<li><b>is_demo</b> (bool): Use demo account if True, real if False (default: True)</li>
33+
<li><b>enable_logging</b> (bool): Enable logging output (default: True)</li>
34+
</ul>
35+
<p><i>This object must be used with <b>await</b> for all network operations.</i></p>
3636

37-
<h3>Method: connect()</h3>
38-
<p>Connect to Pocket Option. <b>Must be awaited.</b></p>
39-
<pre><code>await client.connect()</code></pre>
37+
<h3>Method: <code>await client.connect()</code></h3>
38+
<p>Establishes a connection to Pocket Option using your SSID. <b>Must be awaited before any trading or data calls.</b></p>
39+
<pre><code>await client.connect()
40+
</code></pre>
41+
<p><b>Returns:</b> <code>True</code> if connected successfully, otherwise raises an error.</p>
4042

41-
<h3>Method: disconnect()</h3>
42-
<p>Disconnect from Pocket Option. <b>Must be awaited.</b></p>
43-
<pre><code>await client.disconnect()</code></pre>
43+
<h3>Method: <code>await client.disconnect()</code></h3>
44+
<p>Disconnects from Pocket Option and cleans up resources.</p>
45+
<pre><code>await client.disconnect()
46+
</code></pre>
4447

45-
<h3>Method: get_balance()</h3>
46-
<p>Get your account balance and currency.</p>
47-
<pre><code>balance = await client.get_balance()
48+
<h3>Method: <code>await client.get_balance()</code></h3>
49+
<p>Fetches your current account balance and currency.</p>
50+
<pre><code>balance = await client.get_balance()
4851
print(balance.balance, balance.currency)
4952
</code></pre>
53+
<p><b>Returns:</b> <code>Balance</code> object with <code>balance</code> (float), <code>currency</code> (str), and <code>is_demo</code> (bool).</p>
5054

51-
<h3>Method: get_candles(asset, timeframe, count=100, end_time=None)</h3>
52-
<p>Get historical candle data for an asset and timeframe.</p>
53-
<pre><code>candles = await client.get_candles("EURUSD_otc", 60)
55+
<h3>Method: <code>await client.get_candles(asset, timeframe, count=100, end_time=None)</code></h3>
56+
<p>Retrieves historical candle (OHLC) data for a given asset and timeframe.</p>
57+
<pre><code>candles = await client.get_candles("EURUSD_otc", 60)
5458
for candle in candles:
5559
print(candle.open, candle.close)
5660
</code></pre>
57-
<ul>
58-
<li><b>asset</b> (str): Symbol, e.g. "EURUSD_otc"</li>
59-
<li><b>timeframe</b> (int or str): Timeframe in seconds or string (e.g. 60 or "1m")</li>
60-
<li><b>count</b> (int): Number of candles (default 100)</li>
61-
<li><b>end_time</b> (datetime): End time (default now)</li>
62-
</ul>
61+
<ul>
62+
<li><b>asset</b> (str): Symbol, e.g. <code>"EURUSD_otc"</code></li>
63+
<li><b>timeframe</b> (int or str): Timeframe in seconds or string (e.g. <code>60</code> or <code>"1m"</code>)</li>
64+
<li><b>count</b> (int): Number of candles (default 100)</li>
65+
<li><b>end_time</b> (datetime): End time (default now)</li>
66+
</ul>
67+
<p><b>Returns:</b> List of <code>Candle</code> objects.</p>
6368

64-
<h3>Method: get_candles_dataframe(asset, timeframe, ...)</h3>
65-
<p>Get candle data as a pandas DataFrame.</p>
66-
<pre><code>df = await client.get_candles_dataframe("EURUSD_otc", 60)
69+
<h3>Method: <code>await client.get_candles_dataframe(asset, timeframe, ...)</code></h3>
70+
<p>Retrieves candle data as a pandas DataFrame for easy analysis.</p>
71+
<pre><code>df = await client.get_candles_dataframe("EURUSD_otc", 60)
6772
print(df.head())
6873
</code></pre>
74+
<p><b>Returns:</b> <code>pandas.DataFrame</code> with OHLCV columns indexed by timestamp.</p>
6975

70-
<h3>Method: place_order(asset, amount, direction, duration)</h3>
71-
<p>Place a binary options order (CALL/PUT).</p>
72-
<pre><code>from pocketoptionapi_async import OrderDirection
76+
<h3>Method: <code>await client.place_order(asset, amount, direction, duration)</code></h3>
77+
<p>Places a binary options order (CALL/PUT) for a given asset, amount, direction, and duration.</p>
78+
<pre><code>from pocketoptionapi_async import OrderDirection
7379
order = await client.place_order(
7480
asset="EURUSD_otc",
7581
amount=1.0,
@@ -78,51 +84,45 @@ <h3>Method: place_order(asset, amount, direction, duration)</h3>
7884
)
7985
print(order.order_id, order.status)
8086
</code></pre>
81-
<ul>
82-
<li><b>asset</b> (str): Symbol, e.g. "EURUSD_otc"</li>
83-
<li><b>amount</b> (float): Amount to invest</li>
84-
<li><b>direction</b> (OrderDirection): CALL or PUT</li>
85-
<li><b>duration</b> (int): Duration in seconds (min 5)</li>
86-
</ul>
87+
<ul>
88+
<li><b>asset</b> (str): Symbol, e.g. <code>"EURUSD_otc"</code></li>
89+
<li><b>amount</b> (float): Amount to invest</li>
90+
<li><b>direction</b> (OrderDirection): <code>CALL</code> or <code>PUT</code></li>
91+
<li><b>duration</b> (int): Duration in seconds (minimum 5)</li>
92+
</ul>
93+
<p><b>Returns:</b> <code>OrderResult</code> object with order details and status.</p>
8794

88-
<h3>Method: get_active_orders()</h3>
89-
<p>Get a list of your currently active orders.</p>
90-
<pre><code>orders = await client.get_active_orders()
95+
<h3>Method: <code>await client.get_active_orders()</code></h3>
96+
<p>Returns a list of your currently active (open) orders.</p>
97+
<pre><code>orders = await client.get_active_orders()
9198
for order in orders:
9299
print(order.order_id, order.status)
93100
</code></pre>
101+
<p><b>Returns:</b> List of <code>OrderResult</code> objects.</p>
94102

95-
<h3>Method: check_order_result(order_id)</h3>
96-
<p>Check the result of an order (win/loss/pending).</p>
97-
<pre><code>result = await client.check_order_result(order_id)
103+
<h3>Method: <code>await client.check_order_result(order_id)</code></h3>
104+
<p>Checks the result of a specific order by its ID (win/loss/pending).</p>
105+
<pre><code>result = await client.check_order_result(order_id)
98106
if result:
99107
print(result.status, result.profit)
100108
</code></pre>
109+
<p><b>Returns:</b> <code>OrderResult</code> object or <code>None</code> if not found.</p>
101110

102-
<h3>Method: get_connection_stats()</h3>
103-
<p>Get connection statistics and status.</p>
104-
<pre><code>stats = client.get_connection_stats()
111+
<h3>Method: <code>client.get_connection_stats()</code></h3>
112+
<p>Returns connection statistics and status as a dictionary.</p>
113+
<pre><code>stats = client.get_connection_stats()
105114
print(stats)
106115
</code></pre>
107116

108-
<h3>OrderDirection Enum</h3>
109-
<pre><code>from pocketoptionapi_async import OrderDirection
117+
<h3>Enum: <code>OrderDirection</code></h3>
118+
<p>Specifies the direction of an order.</p>
119+
<pre><code>from pocketoptionapi_async import OrderDirection
110120
OrderDirection.CALL # "call"
111121
OrderDirection.PUT # "put"
112122
</code></pre>
113-
<ul>
114-
<li><b>CALL</b>: Place a call (up) order</li>
115-
<li><b>PUT</b>: Place a put (down) order</li>
116-
</ul>
117-
</div>
118-
<div class="advert">
119-
Want a custom trading bot? <a href="https://shop.chipatrade.com/products/create-your-bot?variant=42924637487206" target="_blank">Let us build it for you!</a>
120-
</div>
121-
</ul>
122-
<h3>OrderDirection</h3>
123123
<ul>
124-
<li><b>OrderDirection.CALL</b> - Place a CALL order</li>
125-
<li><b>OrderDirection.PUT</b> - Place a PUT order</li>
124+
<li><b>CALL</b>: Place a call (up) order</li>
125+
<li><b>PUT</b>: Place a put (down) order</li>
126126
</ul>
127127
</div>
128128
<div class="advert">

docs/style.css

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,31 +91,38 @@ h2, h3 {
9191
}
9292

9393

94+
9495
pre {
95-
background: linear-gradient(90deg, #231942 60%, #7c3aed22 100%);
96+
background: #1e133a;
9697
color: #e0c3fc;
9798
border-radius: 0.7rem;
98-
padding: 1.2rem 1rem 1rem 1.2rem;
99-
font-size: 1.05rem;
100-
overflow-x: auto;
99+
padding: 1.3rem 1.2rem 1.1rem 1.2rem;
100+
font-size: 1.08rem;
101+
font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
101102
margin-bottom: 2.2rem;
102103
position: relative;
103104
box-shadow: 0 2px 16px rgba(124,58,237,0.10);
105+
overflow-x: auto;
106+
white-space: pre;
107+
line-height: 1.6;
108+
border: 1.5px solid #7c3aed33;
104109
}
105110

106111
code {
107-
background: #1e133a;
112+
background: #231942;
108113
color: #e0c3fc;
109114
border-radius: 0.4rem;
110-
padding: 0.2em 0.5em;
115+
padding: 0.18em 0.5em;
111116
font-size: 1em;
117+
font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', monospace;
112118
}
113119

114120
pre code {
115121
background: none;
116122
color: inherit;
117123
padding: 0;
118124
font-size: inherit;
125+
font-family: inherit;
119126
}
120127

121128
pre .copy-btn {

0 commit comments

Comments
 (0)