Example #1
0
                          'cik': str,
                          'conm': str,
                          'type': str,
                          'path': str
                      })

## Most recent filing in TestData: 2019 Q1
NRPCanslimParams = CanslimParams("NRP", all10Qs, all10Ks)
## Load the data, and proceed if successful.
if NRPCanslimParams.loadData(testDir):
    ## Test all the EPS stuff
    ## Test the last four quarters to cover the case where the 10-K was filed instead of the 10-Q.
    print("Getting EPS for Q0:")
    expect = 2.26
    val = NRPCanslimParams.getEpsQuarter(0)
    areEqual(expect, val)

    print("Getting EPS for Q-1:")
    expect = 8.77 - 1.71 - 2.46 - 1.49
    val = NRPCanslimParams.getEpsQuarter(-1)
    areEqual(expect, val)

    print("Getting EPS for Q-2:")
    expect = 1.71
    val = NRPCanslimParams.getEpsQuarter(-2)
    areEqual(expect, val)

    print("Getting EPS for Q-3:")
    expect = 0.0
    val = NRPCanslimParams.getEpsQuarter(-3)
    areEqual(expect, val)
Example #2
0
from CanslimParams import CanslimParams
from SecFiling10Q import SecFiling10Q
from myAssert import areEqual
from os import path as ospath

testDir = ospath.join("..", "TestData")
ticker = "ALEX"

all10Qs = pd.read_csv(ospath.join(testDir, "{:s}_all_10qs.csv".format(ticker.lower())), \
        dtype={'cik':str, 'conm':str, 'type':str, 'path':str, 'date':str})

testfile = all10Qs[all10Qs.date == "2018-05-10"]
filing = SecFiling10Q(ticker)
filename = filing.download(testfile.cik.iloc[0], testfile.conm.iloc[0], testfile.type.iloc[0], \
        testfile.date.iloc[0], testfile.path.iloc[0], downloadPath = testDir)
## Load the data, and proceed if successful.
if filing.load(filename):
    print("Verifying EPS")
    areEqual(0.71, filing.getEps())

    print("Verifying Sales")
    areEqual(113.3 * 1e6, filing.getSales())

    print("Verifying ROE")
    areEqual(47.3 / 1320.6, filing.getRoe())

    print("Verifying Net Income")
    areEqual(47.3 * 1e6, filing.getNetIncome())

    print("Verifying Stockholders' Equity")
    areEqual(1320.6 * 1e6, filing.getStockholdersEquity())
Example #3
0
                      dtype={
                          'cik': str,
                          'conm': str,
                          'type': str,
                          'path': str
                      })

canslim = CanslimParams(ticker, all10Qs, all10Ks)
## Load the data, and proceed if successful.
oldestDate = datetime(2014, 1, 1)
if canslim.loadData("TestData", oldestDate):
    ## Test all the EPS stuff
    for q in range(0, len(epsQ)):
        print("Getting EPS for quarter {:d}".format(q))
        value = canslim.getEpsQuarter(-q)
        areEqual(epsQ[q], value)

    for y in range(0, len(epsY)):
        print("Getting EPS for year {:d}".format(y))
        value = canslim.getEpsAnnual(-y)
        areEqual(epsY[y], value)

    print("Getting EPS growth for Q-1 to Q-2:")
    expect = epsQ[1] / epsQ[2] * 100.0
    val = canslim.getEpsGrowthQuarter(-1, -2)
    areEqual(expect, val)

    # print("Getting EPS growth for Y0 to Y-1:")
    # expect = -0.37/-2.58
    # val = canslim.getEpsGrowthAnnual(0, -1)
    # areEqual(expect, val)
Example #4
0
                      dtype={
                          'cik': str,
                          'conm': str,
                          'type': str,
                          'path': str
                      })

NvdaCanslimParams = CanslimParams("NVDA", all10Qs, all10Ks)
## Load the data, and proceed if successful.
if NvdaCanslimParams.loadData(testDir):
    ## Test all the EPS stuff
    ## Test the last four quarters to cover the case where the 10-K was filed instead of the 10-Q.
    print("Getting EPS for Q0:")
    expect = 1.81
    val = NvdaCanslimParams.getEpsQuarter(0)
    areEqual(expect, val)

    print("Getting EPS for Q-1:")
    expect = 2.05
    val = NvdaCanslimParams.getEpsQuarter(-1)
    areEqual(expect, val)

    print("Getting EPS for Q-2:")
    expect = 5.09 - 1.39 - 0.98 - 0.86
    val = NvdaCanslimParams.getEpsQuarter(-2)
    areEqual(expect, val)

    print("Getting EPS for Q-3:")
    expect = 1.39
    val = NvdaCanslimParams.getEpsQuarter(-3)
    areEqual(expect, val)