# Forex Portal Python API
![](https://img.shields.io/badge/requests-2.28.1-green)
## Installation
```
$ python3 -m pip install forexportal-api
```
## Docs
Initialize the object first
```python
from forexportal import ForexPortalAPI
forex = ForexPortalAPI()
```
### Class methods
#### forex.getQuoteInfo(quote)
This method returns information about the quote, for example `EURUSD`, `AAPL`, `#Bitcoin`, eth.
```python
>>> forex.getQuoteInfo('EURUSD')
Quote(symbol='EURUSD', description='Euro vs US Dollar', digits=4, ask=1.0165, bid=1.0162, change=-0.0001, minmax={'min': 1.0147, 'max': 1.0255}, change24h=-0.0035, position={'sell': 48.84, 'buy': 51.16}, timestamp=1659099955, change24h_percent=-0.34, rate_open={'previous_close': 1.0193, 'open': 1.0192, 'change': -0.003, 'change_percent': -0.3}, rate_24h={'previous_close': 1.0207, 'open': 1.0207, 'change': -0.0045, 'change_percent': -0.44}, rate_7d={'previous_close': 1.0221, 'open': 1.0222, 'change': -0.006, 'change_percent': -0.59}, rate_30d={'previous_close': 1.0523, 'open': 1.0522, 'change': -0.036, 'change_percent': -3.54}, minmax_52w={'min': 0.9953, 'max': 1.1909}, minmax_7d={'min': 1.0097, 'max': 1.0258}, about='EURUSD is a currency pair that is traded with a relatively low spread and reflects the correlation between the euro and the US dollar. The euro is the base currency in the pair while the US dollar is the quoted one. Quotes of the currency pair show how many dollars are needed to buy 1 euro.')
```
#### forex.getQuoteHLOC(quote)
This method returns the HLOC indicator of the specified quote
```python
>>> forex.getQuoteHLOC('EURUSD', limit = 5)
[Tick(open=1.0222, high=1.0231, close=1.0203, low=1.0186, date=1659085200), Tick(open=1.0204, high=1.0245, close=1.0243, low=1.0198, date=1659088800), Tick(open=1.0241, high=1.0241, close=1.0208, low=1.0206, date=1659092400), Tick(open=1.0211, high=1.0211, close=1.0178, low=1.0175, date=1659096000), Tick(open=1.0177, high=1.0178, close=1.0161, low=1.0147, date=1659099600)]
```
#### forex.getQuoteSignals(quote)
Returns quote signals
```python
>>> forex.getQuoteSignals('EURUSD', limit = 5)
[Signal(comment='Candles: Harami', pair='EURUSD', cmd='Buy Stop', trading_system='Auto', price=1.0125, sl=1.01028, tp=1.02893, period='H1', author=False, timestamp=1658869264, cmd_id=4, trading_system_id=3, pair_description='Euro vs US Dollar'), Signal(comment='Candles: Stick sandwich', pair='EURUSD', cmd='Buy Stop', trading_system='Auto', price=1.013, sl=1.01028, tp=1.02943, period='H1', author=False, timestamp=1658865611, cmd_id=4, trading_system_id=3, pair_description='Euro vs US Dollar'), Signal(comment='Harmonic: Gartly', pair='EURUSD', cmd='Sell Stop', trading_system='Auto', price=1.0171, sl=1.0278, tp=1.0079, period='H1', author=False, timestamp=1658736000, cmd_id=5, trading_system_id=3, pair_description='Euro vs US Dollar'), Signal(comment='Levels: Trend channel', pair='EURUSD', cmd='Sell Stop', trading_system='Auto', price=1.01838, sl=1.02936, tp=1.0074, period='H1', author=False, timestamp=1658493067, cmd_id=5, trading_system_id=3, pair_description='Euro vs US Dollar'), Signal(comment='Waves: Impulse', pair='EURUSD', cmd='Buy Stop', trading_system='Auto', price=1.0278, sl=1.0109, tp=1.04335, period='H1', author=False, timestamp=1658376038, cmd_id=4, trading_system_id=3, pair_description='Euro vs US Dollar')]
```
#### forex.subscribeQuote(quote)
Tracks changes in the quotation rate in real time
```python
for tick in forex.subscribeQuote('EURUSD'):
  print(tick)
SubTick(digits=4, ask=1.0158, bid=1.0155, change=-0.0001, symbol='EURUSD', lasttime=1659112284)...
```
