fws 0.0.6
A python client for FreightWaves API
Requires Python: >=3.7

# Install
```sh
pip install fws
```

# Quick start
```python
from fws.client import FWSClient
client = FWSClient("<FREIGHTWAVES_USERNAME>", "<FREIGHTWAVES_PASSWORD>")

df = client.get_index_list()
'''
                            index_Name    index frequency unit_Type                    description
0                     DOE Diesel Price      DOE         W       USD                                                   
1       Diesel Truck Stop Actual Price      DTS         D       USD                                                   
2                      Outbound Tender     OTRI         D      PCNT         Percentage of Outbound
3                       Inbound Tender     ITRI         D      PCNT          Percentage of Inbound
4                   Cass Freight Index     CFIS         M      INDX         Overall North American
...                                ...      ...       ...       ...                            ...
1836       Capacity Trend Market Score   CTSCR4         D     INDEX           Capacity Trend Score  
1837         Capacity Trend Lane Score  CTLSSR4         D     INDEX     Measure of overall shipper 
1838         Capacity Trend Lane Score  CTLSCR4         D     INDEX       Measure of overall asset
1839                    Capacity Trend    CTDV4         D     INDEX   Capacity Trend Direction VAN 
1840             Capacity Trend Market    CTDR4         D     INDEX       Capacity Trend Direction 
'''

df = client.get_level_list()
'''
                   qualifier_Name                                        description          code
0                            Zip3  First 3 digits of a zip code in the USA or Can...          ZIP3
1                        X-Market  Expanded Market areas are a slightly larger co...          XMKT
2                            USDA                              Extended USDA regions          USDA
3                      Truck Type                                      Type of truck        TRUCKT
4                      Truck Make                                      Make of Truck        TRUCKM
5                    Trailer Type                                    Type of trailer        TRAILT
..                            ...                                                ...           ...
48                       Currency                                National Currencies      CURRENCY
49                         County                                        US Counties        COUNTY
50             Country to Country       National Granularity to National Granularity           C2C
51               Canadian Market           Regions of Canada by trucking populations        CANADA
52             Calculation Period             Time period for data point calculation            CP
53               Airline Entities                                   Airline Entities        AIRENT
54            Agg and Commodities                 Agriculture and Commodity Products        AGGCOM
'''

df = client.get_lane_list()
'''
      qualifier            description outBoundCode outBoundCity  ...  inBoundCity inBoundState
0        ABEALB    Allentown to Albany          ABE    Allentown  ...       Albany           NY
1        ABEAMA  Allentown to Amarillo          ABE    Allentown  ...     Amarillo           TX
2        ABEATL   Allentown to Atlanta          ABE    Allentown  ...      Atlanta           GA
...         ...                    ...          ...          ...  ...          ...          ...
22198    YYZYXU      Toronto to London          YYZ      Toronto  ...       London           ON
22199    YYZYYC     Toronto to Calgary          YYZ      Toronto  ...      Calgary           AB
22200    YYZYYZ     Toronto to Toronto          YYZ      Toronto  ...      Toronto           ON
'''

df = client.get_qualifiers_for_index("OTRI")
'''
     index qualifier
0     OTRI    PHXFAT
1     OTRI    CHIPHL
2     OTRI    STLDAL
3     OTRI    MEMIND
4     OTRI    ATLSTL
...    ...       ...
2800  OTRI    FWABMI
2801  OTRI    RDUFWA
2802  OTRI    GYYFSD
2803  OTRI    CMHRIC
2804  OTRI    CHACVG
'''

# Get ticker by qualifier
df = client.get_index("OTRI", qualifier="STLDAL", date="2021-01-01")
'''
        data_Timestamp  data_Value index qualifier qualifier_Code
0  2021-01-01T00:00:00       31.29  OTRI    STLDAL        LANESNA
'''

# Or to use multiple qualifiers and a date range
df = client.get_indices(
        ["OTRI", "ITRI"],
        qualifiers=["STLDAL", "STLCHI"],
        start_date="2021-01-01",
        end_date="2021-02-01"
)
'''
         data_Timestamp  data_Value index qualifier qualifier_Code
0   2021-02-01T00:00:00       23.54  OTRI    STLCHI        LANESNA
1   2021-02-01T00:00:00       25.58  OTRI    STLDAL        LANESNA
2   2021-01-31T00:00:00       25.89  OTRI    STLDAL        LANESNA
3   2021-01-31T00:00:00       23.46  OTRI    STLCHI        LANESNA
4   2021-01-30T00:00:00       25.72  OTRI    STLDAL        LANESNA
..                  ...         ...   ...       ...            ...
59  2021-01-03T00:00:00       31.08  OTRI    STLDAL        LANESNA
60  2021-01-02T00:00:00       31.02  OTRI    STLDAL        LANESNA
61  2021-01-02T00:00:00       24.77  OTRI    STLCHI        LANESNA
62  2021-01-01T00:00:00       25.07  OTRI    STLCHI        LANESNA
63  2021-01-01T00:00:00       31.29  OTRI    STLDAL        LANESNA
'''

# Get ticker by level
df = client.get_index(
        "OTRI",                 # Or ["OTRI", ...]
        level="NATIONAL",       # Or levels=["NATIONAL", ...]
        start_date="2021-01-01",
        end_date="2021-01-02"
)
'''
        data_Timestamp  data_Value index qualifier qualifier_Code
0  2021-01-02T00:00:00        2.39  OTRI       CAN       NATIONAL
1  2021-01-02T00:00:00       24.99  OTRI       USA       NATIONAL
2  2021-01-01T00:00:00        2.39  OTRI       CAN       NATIONAL
3  2021-01-01T00:00:00       25.34  OTRI       USA       NATIONAL
'''

# Get ticker by lane
df = client.get_index(
        "OTRI",                 # Or ["OTRI", ...]
        lane="ATL",             # Or lanes=["ATL", ...]
        start_date="2021-01-01",
        end_date="2021-01-02"
)
'''
          data_Timestamp  data_Value index qualifier qualifier_Code
0    2021-01-02T00:00:00       31.32  OTRI    ABEATL        LANESNA
1    2021-01-02T00:00:00       22.50  OTRI       ATL           XMKT
2    2021-01-02T00:00:00       25.85  OTRI    ATLABE        LANESNA
3    2021-01-02T00:00:00       24.65  OTRI    ATLAUS        LANESNA
4    2021-01-02T00:00:00       28.08  OTRI    ATLBHM        LANESNA
..                   ...         ...   ...       ...            ...
257  2021-01-01T00:00:00       26.21  OTRI    ATLBMI        LANESNA
258  2021-01-01T00:00:00       28.27  OTRI    ATLBHM        LANESNA
259  2021-01-01T00:00:00       24.80  OTRI    ATLAUS        LANESNA
260  2021-01-01T00:00:00       25.88  OTRI    ATLABE        LANESNA
261  2021-01-01T00:00:00       22.68  OTRI       ATL           XMKT
'''