mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
Add supply and customer feature (#533)
* add supply and customer feature * Update README.md * Update README.md * Update README.md
This commit is contained in:
@@ -247,6 +247,8 @@ Command|Description|Source
|
||||
`ftd` |display fails-to-deliver data [SEC](https://www.sec.gov)
|
||||
`shortview` |shows price vs short interest volume [Stockgrid](https://stockgrid.io)
|
||||
`darkpos` |net short vs position [Stockgrid](https://stockgrid.io)
|
||||
`supplier` |list of suppliers [csimarket](https://csimarket.com)
|
||||
`customer` |list of customers [csimarket](https://csimarket.com)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,10 @@ This menu aims to help in due-diligence of a pre-loaded stock, and the usage of
|
||||
* shows price vs short interest volume [Stockgrid]
|
||||
* [darkpos](#darkpos)
|
||||
* net short vs position [Stockgrid]
|
||||
|
||||
* [supplier](#supplier)
|
||||
* list of suppliers [csimarket]
|
||||
* [customer](#customer)
|
||||
* list of customers [csimarket]
|
||||
|
||||
## news <a name="news"></a>
|
||||
|
||||
@@ -235,3 +238,23 @@ Shows Net Short Vol. vs Position. [Source: Stockgrid]
|
||||
<img width="958" alt="darkpos_raw" src="https://user-images.githubusercontent.com/25267873/122646989-ee758980-d119-11eb-9f67-f51f0b75c49d.png">
|
||||
|
||||
|
||||
## supplier <a name="supplier"></a>
|
||||
|
||||
```text
|
||||
usage: supplier
|
||||
```
|
||||
|
||||
List of suppliers from ticker provided. [Source: CSIMarket]
|
||||
|
||||
<img width="974" alt="supplier" src="https://user-images.githubusercontent.com/25267873/124523361-b98e5580-ddee-11eb-94dc-08e4df1b17c0.png">
|
||||
|
||||
|
||||
## customer <a name="customer"></a>
|
||||
|
||||
```text
|
||||
usage: customer
|
||||
```
|
||||
|
||||
List of customer from ticker provided. [Source: CSIMarket]
|
||||
|
||||
<img width="980" alt="customer" src="https://user-images.githubusercontent.com/25267873/124523360-b85d2880-ddee-11eb-8413-836de13d13ce.png">
|
||||
|
||||
92
gamestonk_terminal/due_diligence/csimarket_view.py
Normal file
92
gamestonk_terminal/due_diligence/csimarket_view.py
Normal file
@@ -0,0 +1,92 @@
|
||||
"""Stockgrid DD View"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import argparse
|
||||
from typing import List
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from gamestonk_terminal.helper_funcs import (
|
||||
parse_known_args_and_warn,
|
||||
)
|
||||
|
||||
|
||||
def suppliers(ticker: str, other_args: List[str]):
|
||||
"""Print suppliers from ticker provided
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ticker: str
|
||||
Ticker to select suppliers from
|
||||
other_args : List[str]
|
||||
Argparse arguments
|
||||
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="supplier",
|
||||
add_help=False,
|
||||
description="List of suppliers from ticker provided. [Source: CSIMarket]",
|
||||
)
|
||||
try:
|
||||
ns_parser = parse_known_args_and_warn(parser, other_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
url_supply_chain = f"https://csimarket.com/stocks/competitionNO3.php?supply&code={ticker.upper()}"
|
||||
text_supplier_chain = BeautifulSoup(requests.get(url_supply_chain).text, "lxml")
|
||||
|
||||
l_supplier = list()
|
||||
for supplier in text_supplier_chain.findAll(
|
||||
"td", {"class": "plavat svjetlirub dae al"}
|
||||
):
|
||||
l_supplier.append(supplier.text)
|
||||
|
||||
if l_supplier:
|
||||
print("List of Suppliers: " + ", ".join(l_supplier) + "\n")
|
||||
else:
|
||||
print("No suppliers found.\n")
|
||||
|
||||
except Exception as e:
|
||||
print(e, "\n")
|
||||
|
||||
|
||||
def customers(ticker: str, other_args: List[str]):
|
||||
"""Print customers from ticker provided
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ticker: str
|
||||
Ticker to select customers from
|
||||
other_args : List[str]
|
||||
Argparse arguments
|
||||
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="customer",
|
||||
add_help=False,
|
||||
description="List of customers from ticker provided. [Source: CSIMarket]",
|
||||
)
|
||||
try:
|
||||
ns_parser = parse_known_args_and_warn(parser, other_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
url_customer_chain = (
|
||||
f"https://csimarket.com/stocks/custexNO.php?markets&code={ticker.upper()}"
|
||||
)
|
||||
text_customer_chain = BeautifulSoup(
|
||||
requests.get(url_customer_chain).text, "lxml"
|
||||
)
|
||||
|
||||
l_customer = list()
|
||||
for customer in text_customer_chain.findAll(
|
||||
"td", {"class": "plava svjetlirub"}
|
||||
):
|
||||
l_customer.append(customer.text)
|
||||
|
||||
if l_customer:
|
||||
print("List of Customers: " + ", ".join(l_customer) + "\n")
|
||||
else:
|
||||
print("No customers found.\n")
|
||||
|
||||
except Exception as e:
|
||||
print(e, "\n")
|
||||
@@ -18,6 +18,7 @@ from gamestonk_terminal.due_diligence import finra_view
|
||||
from gamestonk_terminal.due_diligence import sec_view
|
||||
from gamestonk_terminal.due_diligence import stockgrid_dd_view as sg_view
|
||||
from gamestonk_terminal.due_diligence import finnhub_view
|
||||
from gamestonk_terminal.due_diligence import csimarket_view
|
||||
from gamestonk_terminal import feature_flags as gtff
|
||||
from gamestonk_terminal.helper_funcs import get_flair
|
||||
from gamestonk_terminal.menu import session
|
||||
@@ -49,6 +50,8 @@ class DueDiligenceController:
|
||||
"ftd",
|
||||
"shortview",
|
||||
"darkpos",
|
||||
"supplier",
|
||||
"customer",
|
||||
]
|
||||
|
||||
def __init__(self, ticker: str, start: str, interval: str, stock: DataFrame):
|
||||
@@ -120,6 +123,8 @@ class DueDiligenceController:
|
||||
print(" ftd fails-to-deliver data [SEC]")
|
||||
print(" shortview price vs short interest volume [Stockgrid.io]")
|
||||
print(" darkpos net short vs position [Stockgrid.io]")
|
||||
print(" supplier list of suppliers [csimarket]")
|
||||
print(" customer list of customers [csimarket]")
|
||||
print("")
|
||||
|
||||
def switch(self, an_input: str):
|
||||
@@ -234,6 +239,14 @@ class DueDiligenceController:
|
||||
"""Process darkpos command"""
|
||||
sg_view.darkpos(self.ticker, other_args)
|
||||
|
||||
def call_supplier(self, other_args: List[str]):
|
||||
"""Process supplier command"""
|
||||
csimarket_view.suppliers(self.ticker, other_args)
|
||||
|
||||
def call_customer(self, other_args: List[str]):
|
||||
"""Process customer command"""
|
||||
csimarket_view.customers(self.ticker, other_args)
|
||||
|
||||
|
||||
def menu(ticker: str, start: str, interval: str, stock: DataFrame):
|
||||
"""Due Diligence Menu
|
||||
|
||||
Reference in New Issue
Block a user