Skip to content

Commit ecc3389

Browse files
committed
try1
1 parent a352f5c commit ecc3389

File tree

4 files changed

+86
-20
lines changed

4 files changed

+86
-20
lines changed

docs/source/index.rst

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,9 @@ Getting Started Tutorials
5555
:caption: Tutorials
5656

5757
tutorial/installation
58-
tutorial/simple_example
58+
tutorial/example1_plot
5959

6060

61-
Dataset Documentation
62-
---------------------
63-
64-
.. toctree::
65-
:maxdepth: 2
66-
:caption: Datasets
67-
68-
datasets/equity
69-
datasets/interest_rates
70-
datasets/options
71-
.. datasets/financials_balancesheet
72-
.. datasets/financials_cashflows
73-
.. datasets/financialss_income
74-
7561
API Documentation
7662
-----------------
7763

@@ -88,6 +74,22 @@ API Documentation
8874
.. api/get_is
8975

9076

77+
Dataset Documentation
78+
---------------------
79+
80+
.. toctree::
81+
:maxdepth: 2
82+
:caption: Datasets
83+
84+
datasets/equity
85+
datasets/interest_rates
86+
datasets/options
87+
.. datasets/financials_balancesheet
88+
.. datasets/financials_cashflows
89+
.. datasets/financialss_income
90+
91+
92+
9193

9294
Source code
9395
-----------

docs/source/tutorial.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
Getting Started
22
###############
33

4-
5-
64
.. toctree::
75
:maxdepth: 2
86

97
tutorial/installation
10-
tutorial/simple_example
8+
tutorial/example1_plot
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
How to Read and Plot Stock Prices
2+
#################################
3+
4+
In this guide, we will walk you through the steps to retrieve
5+
financial data using MoabDB and how to create a basic
6+
chart using the `matplotlib` library.
7+
8+
9+
Prerequisites
10+
=============
11+
12+
- For advanced plotting, ensure you've set up and authenticated with MoabDB as described in the Quick Start guide.
13+
The advanced plotting will assume you have a `config.json` file in your working directory with the following contents:
14+
15+
.. code-block:: ini
16+
17+
[Credentials]
18+
email = 'your-email@example.com'
19+
api_key = 'your-secret-api-key'
20+
21+
22+
- You will need `matplotlib` installed. If you haven't already, you can install it with:
23+
24+
.. code-block:: bash
25+
26+
pip install matplotlib
27+
28+
29+
Fetching Data from the API
30+
==========================
31+
32+
First, let's retrieve some financial data. For this example, we'll fetch historical closing prices for a given stock (e.g., `AAPL`):
33+
34+
.. code-block:: python
35+
36+
import moabdb as mdb
37+
38+
mdb.login('your-email-from-config', 'your-api-key-from-config')
39+
data_df = mdb.get_equity('AAPL', columns=['Date', 'Close'])
40+
41+
Visualizing Data with Matplotlib
42+
================================
43+
44+
With our data in hand, we can now plot it:
45+
46+
.. code-block:: python
47+
:linenos:
48+
49+
import matplotlib.pyplot as plt
50+
51+
# Extracting date and closing price data
52+
dates = data_df['Date'].tolist()
53+
closing_prices = data_df['Close'].tolist()
54+
55+
# Creating the plot
56+
plt.figure(figsize=(10,6))
57+
plt.plot(dates, closing_prices, label='AAPL Closing Prices', color='blue')
58+
plt.title('AAPL Historical Closing Prices')
59+
plt.xlabel('Date')
60+
plt.ylabel('Closing Price (in $)')
61+
plt.grid(True)
62+
plt.legend()
63+
plt.tight_layout()
64+
plt.xticks(dates[::10]) # Show every 10th date for clarity
65+
plt.show()
66+
67+
With these simple steps, you've fetched financial data using [Your API Name] and visualized it with a basic chart. Explore more with different stocks, date ranges, or chart types to gain richer insights!
68+

docs/source/tutorial/simple_example.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)