from stonky.enums import CurrencyType
from stonky.stock import Stock

AMD_STOCK = Stock(
    ticket="AMD",
    currency=CurrencyType.USD,
    current_amount=452.49,
    delta_amount=14.540009,
    delta_percent=0.033234306,
    market_price=452.04,
    volume=41486205,
)

AAPL_STOCK = Stock(
    ticket="AAPL",
    currency=CurrencyType.USD,
    current_amount=81.83,
    delta_amount=-0.7700043,
    delta_percent=-0.009320957,
    market_price=81.84,
    volume=57092710,
)

VGRO_TO_STOCK = Stock(
    ticket="VGRO.TO",
    currency=CurrencyType.USD,
    current_amount=27.12,
    delta_amount=-0.12000084,
    delta_percent=-0.004402085,
    market_price=27.14,
    volume=126570,
)

SHOP_TO_STOCK = Stock(
    ticket="SHOP.TO",
    currency=CurrencyType.CAD,
    current_amount=1318.02,
    delta_amount=10.869995,
    delta_percent=0.008287331,
    market_price=1322.51,
    volume=127212,
)


AAPL_RESPONSE = {
    "quoteSummary": {
        "result": [
            {
                "summaryDetail": {
                    "maxAge": 1,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "previousClose": {"raw": 437.5, "fmt": "437.50"},
                    "open": {"raw": 441.99, "fmt": "441.99"},
                    "dayLow": {"raw": 441.19, "fmt": "441.19"},
                    "dayHigh": {"raw": 453.1, "fmt": "453.10"},
                    "regularMarketPreviousClose": {
                        "raw": 437.5,
                        "fmt": "437.50",
                    },
                    "regularMarketOpen": {"raw": 441.99, "fmt": "441.99"},
                    "regularMarketDayLow": {"raw": 441.19, "fmt": "441.19"},
                    "regularMarketDayHigh": {"raw": 453.1, "fmt": "453.10"},
                    "dividendRate": {"raw": 3.28, "fmt": "3.28"},
                    "dividendYield": {"raw": 0.0075, "fmt": "0.75%"},
                    "exDividendDate": {"raw": 1596758400, "fmt": "2020-08-07"},
                    "payoutRatio": {"raw": 0.2373, "fmt": "23.73%"},
                    "fiveYearAvgDividendYield": {"raw": 1.56, "fmt": "1.56"},
                    "beta": {"raw": 1.226373, "fmt": "1.23"},
                    "trailingPE": {"raw": 34.284412, "fmt": "34.28"},
                    "forwardPE": {"raw": 29.088804, "fmt": "29.09"},
                    "volume": {
                        "raw": 41486205,
                        "fmt": "41.49M",
                        "longFmt": "41,486,205",
                    },
                    "regularMarketVolume": {
                        "raw": 41486205,
                        "fmt": "41.49M",
                        "longFmt": "41,486,205",
                    },
                    "averageVolume": {
                        "raw": 36773992,
                        "fmt": "36.77M",
                        "longFmt": "36,773,992",
                    },
                    "averageVolume10days": {
                        "raw": 50134385,
                        "fmt": "50.13M",
                        "longFmt": "50,134,385",
                    },
                    "averageDailyVolume10Day": {
                        "raw": 50134385,
                        "fmt": "50.13M",
                        "longFmt": "50,134,385",
                    },
                    "bid": {"raw": 452.49, "fmt": "452.49"},
                    "ask": {"raw": 452.67, "fmt": "452.67"},
                    "bidSize": {"raw": 2200, "fmt": "2.2k", "longFmt": "2,200"},
                    "askSize": {"raw": 1000, "fmt": "1k", "longFmt": "1,000"},
                    "marketCap": {
                        "raw": 1932755861504,
                        "fmt": "1.93T",
                        "longFmt": "1,932,755,861,504",
                    },
                    "yield": {},
                    "ytdReturn": {},
                    "totalAssets": {},
                    "expireDate": {},
                    "strikePrice": {},
                    "openInterest": {},
                    "fiftyTwoWeekLow": {"raw": 199.67, "fmt": "199.67"},
                    "fiftyTwoWeekHigh": {"raw": 457.65, "fmt": "457.65"},
                    "priceToSalesTrailing12Months": {
                        "raw": 7.0575366,
                        "fmt": "7.06",
                    },
                    "fiftyDayAverage": {"raw": 390.98856, "fmt": "390.99"},
                    "twoHundredDayAverage": {"raw": 321.10718, "fmt": "321.11"},
                    "trailingAnnualDividendRate": {"raw": 3.13, "fmt": "3.13"},
                    "trailingAnnualDividendYield": {
                        "raw": 0.007154286,
                        "fmt": "0.72%",
                    },
                    "navPrice": {},
                    "currency": "USD",
                    "fromCurrency": None,
                    "toCurrency": None,
                    "lastMarket": None,
                    "volume24Hr": {},
                    "volumeAllCurrencies": {},
                    "circulatingSupply": {},
                    "algorithm": None,
                    "maxSupply": {},
                    "startDate": {},
                    "tradeable": False,
                },
                "price": {
                    "maxAge": 1,
                    "preMarketChangePercent": {
                        "raw": 0.00973716,
                        "fmt": "0.97%",
                    },
                    "preMarketChange": {"raw": 4.26001, "fmt": "4.26"},
                    "preMarketTime": 1597238999,
                    "preMarketPrice": {"raw": 441.76, "fmt": "441.76"},
                    "preMarketSource": "FREE_REALTIME",
                    "postMarketChangePercent": {
                        "raw": 0.0009954466,
                        "fmt": "0.10%",
                    },
                    "postMarketChange": {"raw": 0.4499817, "fmt": "0.45"},
                    "postMarketTime": 1597276785,
                    "postMarketPrice": {"raw": 452.49, "fmt": "452.49"},
                    "postMarketSource": "DELAYED",
                    "regularMarketChangePercent": {
                        "raw": 0.033234306,
                        "fmt": "3.32%",
                    },
                    "regularMarketChange": {"raw": 14.540009, "fmt": "14.54"},
                    "regularMarketTime": 1597262401,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "regularMarketPrice": {"raw": 452.04, "fmt": "452.04"},
                    "regularMarketDayHigh": {"raw": 453.1, "fmt": "453.10"},
                    "regularMarketDayLow": {"raw": 441.19, "fmt": "441.19"},
                    "regularMarketVolume": {
                        "raw": 41486205,
                        "fmt": "41.49M",
                        "longFmt": "41,486,205.00",
                    },
                    "averageDailyVolume10Day": {
                        "raw": 50134385,
                        "fmt": "50.13M",
                        "longFmt": "50,134,385",
                    },
                    "averageDailyVolume3Month": {
                        "raw": 36773992,
                        "fmt": "36.77M",
                        "longFmt": "36,773,992",
                    },
                    "regularMarketPreviousClose": {
                        "raw": 437.5,
                        "fmt": "437.50",
                    },
                    "regularMarketSource": "FREE_REALTIME",
                    "regularMarketOpen": {"raw": 441.99, "fmt": "441.99"},
                    "strikePrice": {},
                    "openInterest": {},
                    "exchange": "NMS",
                    "exchangeName": "NasdaqGS",
                    "exchangeDataDelayedBy": 0,
                    "marketState": "POSTPOST",
                    "quoteType": "EQUITY",
                    "symbol": "AAPL",
                    "underlyingSymbol": None,
                    "shortName": "Apple Inc.",
                    "longName": "Apple Inc.",
                    "currency": "USD",
                    "quoteSourceName": "Delayed Quote",
                    "currencySymbol": "$",
                    "fromCurrency": None,
                    "toCurrency": None,
                    "lastMarket": None,
                    "volume24Hr": {},
                    "volumeAllCurrencies": {},
                    "circulatingSupply": {},
                    "marketCap": {
                        "raw": 1932755861504,
                        "fmt": "1.93T",
                        "longFmt": "1,932,755,861,504.00",
                    },
                },
            }
        ],
        "error": None,
    }
}

BTC_RESPONSE = {
    "quoteSummary": {
        "result": [
            {
                "summaryDetail": {
                    "maxAge": 1,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "previousClose": {"raw": 11583.987, "fmt": "11,583.99"},
                    "open": {"raw": 11583.987, "fmt": "11,583.99"},
                    "dayLow": {"raw": 11568.912, "fmt": "11,568.91"},
                    "dayHigh": {"raw": 11649.112, "fmt": "11,649.11"},
                    "regularMarketPreviousClose": {
                        "raw": 11583.987,
                        "fmt": "11,583.99",
                    },
                    "regularMarketOpen": {"raw": 11583.987, "fmt": "11,583.99"},
                    "regularMarketDayLow": {
                        "raw": 11568.912,
                        "fmt": "11,568.91",
                    },
                    "regularMarketDayHigh": {
                        "raw": 11649.112,
                        "fmt": "11,649.11",
                    },
                    "dividendRate": {},
                    "dividendYield": {},
                    "exDividendDate": {},
                    "payoutRatio": {},
                    "fiveYearAvgDividendYield": {},
                    "beta": {},
                    "forwardPE": {},
                    "volume": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232",
                    },
                    "regularMarketVolume": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232",
                    },
                    "averageVolume": {
                        "raw": 23604677600,
                        "fmt": "23.6B",
                        "longFmt": "23,604,677,600",
                    },
                    "averageVolume10days": {
                        "raw": 22428947875,
                        "fmt": "22.43B",
                        "longFmt": "22,428,947,875",
                    },
                    "averageDailyVolume10Day": {
                        "raw": 22428947875,
                        "fmt": "22.43B",
                        "longFmt": "22,428,947,875",
                    },
                    "bid": {},
                    "ask": {},
                    "bidSize": {},
                    "askSize": {},
                    "marketCap": {
                        "raw": 213843984384,
                        "fmt": "213.84B",
                        "longFmt": "213,843,984,384",
                    },
                    "yield": {},
                    "ytdReturn": {},
                    "totalAssets": {},
                    "expireDate": {},
                    "strikePrice": {},
                    "openInterest": {},
                    "fiftyTwoWeekLow": {"raw": 4106.981, "fmt": "4,106.98"},
                    "fiftyTwoWeekHigh": {"raw": 12045.141, "fmt": "12,045.14"},
                    "priceToSalesTrailing12Months": {},
                    "fiftyDayAverage": {"raw": 9946.923, "fmt": "9,946.92"},
                    "twoHundredDayAverage": {
                        "raw": 8833.817,
                        "fmt": "8,833.82",
                    },
                    "trailingAnnualDividendRate": {},
                    "trailingAnnualDividendYield": {},
                    "navPrice": {},
                    "currency": "USD",
                    "fromCurrency": "BTC",
                    "toCurrency": "USD=X",
                    "lastMarket": "CoinMarketCap",
                    "volume24Hr": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232.00",
                    },
                    "volumeAllCurrencies": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232.00",
                    },
                    "circulatingSupply": {
                        "raw": 18459200,
                        "fmt": "18.46M",
                        "longFmt": "18,459,200.00",
                    },
                    "algorithm": None,
                    "maxSupply": {},
                    "startDate": {"raw": 1367107200, "fmt": "2013-04-28"},
                    "tradeable": False,
                },
                "price": {
                    "maxAge": 1,
                    "preMarketChange": {},
                    "preMarketPrice": {},
                    "postMarketChange": {},
                    "postMarketPrice": {},
                    "regularMarketChangePercent": {
                        "raw": 6.0107894e-05,
                        "fmt": "0.01%",
                    },
                    "regularMarketChange": {"raw": 0.69628906, "fmt": "0.70"},
                    "regularMarketTime": 1597288594,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "regularMarketPrice": {
                        "raw": 11584.684,
                        "fmt": "11,584.68",
                    },
                    "regularMarketDayHigh": {
                        "raw": 11649.112,
                        "fmt": "11,649.11",
                    },
                    "regularMarketDayLow": {
                        "raw": 11568.912,
                        "fmt": "11,568.91",
                    },
                    "regularMarketVolume": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232.00",
                    },
                    "averageDailyVolume10Day": {
                        "raw": 22428947875,
                        "fmt": "22.43B",
                        "longFmt": "22,428,947,875",
                    },
                    "averageDailyVolume3Month": {
                        "raw": 23604677600,
                        "fmt": "23.6B",
                        "longFmt": "23,604,677,600",
                    },
                    "regularMarketPreviousClose": {
                        "raw": 11583.987,
                        "fmt": "11,583.99",
                    },
                    "regularMarketSource": "FREE_REALTIME",
                    "regularMarketOpen": {"raw": 11583.987, "fmt": "11,583.99"},
                    "strikePrice": {},
                    "openInterest": {},
                    "exchange": "CCC",
                    "exchangeName": "CCC",
                    "exchangeDataDelayedBy": 0,
                    "marketState": "REGULAR",
                    "quoteType": "CRYPTOCURRENCY",
                    "symbol": "BTC-USD",
                    "underlyingSymbol": None,
                    "shortName": "Bitcoin USD",
                    "longName": None,
                    "currency": "USD",
                    "quoteSourceName": "CryptoCompare",
                    "currencySymbol": "$",
                    "fromCurrency": "BTC",
                    "toCurrency": "USD=X",
                    "lastMarket": "CoinMarketCap",
                    "volume24Hr": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232.00",
                    },
                    "volumeAllCurrencies": {
                        "raw": 24981215232,
                        "fmt": "24.98B",
                        "longFmt": "24,981,215,232.00",
                    },
                    "circulatingSupply": {
                        "raw": 18459200,
                        "fmt": "18.46M",
                        "longFmt": "18,459,200.00",
                    },
                    "marketCap": {
                        "raw": 213843984384,
                        "fmt": "213.84B",
                        "longFmt": "213,843,984,384.00",
                    },
                },
            }
        ],
        "error": None,
    }
}

HBLFX_RESPONSE = {
    "quoteSummary": {
        "result": [
            {
                "summaryDetail": {
                    "maxAge": 1,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "previousClose": {"raw": 15.04, "fmt": "15.04"},
                    "open": {},
                    "dayLow": {},
                    "dayHigh": {},
                    "regularMarketPreviousClose": {
                        "raw": 15.04,
                        "fmt": "15.04",
                    },
                    "regularMarketOpen": {},
                    "regularMarketDayLow": {},
                    "regularMarketDayHigh": {},
                    "dividendRate": {},
                    "dividendYield": {},
                    "exDividendDate": {},
                    "payoutRatio": {},
                    "fiveYearAvgDividendYield": {},
                    "beta": {},
                    "forwardPE": {},
                    "volume": {},
                    "regularMarketVolume": {},
                    "averageVolume": {"raw": 0, "fmt": None, "longFmt": "0"},
                    "averageVolume10days": {
                        "raw": 0,
                        "fmt": None,
                        "longFmt": "0",
                    },
                    "averageDailyVolume10Day": {
                        "raw": 0,
                        "fmt": None,
                        "longFmt": "0",
                    },
                    "bid": {},
                    "ask": {},
                    "bidSize": {},
                    "askSize": {},
                    "marketCap": {},
                    "yield": {"raw": 0.0279, "fmt": "2.79%"},
                    "ytdReturn": {"raw": -0.0251, "fmt": "-2.51%"},
                    "totalAssets": {
                        "raw": 13300383744,
                        "fmt": "13.3B",
                        "longFmt": "13,300,383,744",
                    },
                    "expireDate": {},
                    "strikePrice": {},
                    "openInterest": {},
                    "fiftyTwoWeekLow": {"raw": 11.73, "fmt": "11.73"},
                    "fiftyTwoWeekHigh": {"raw": 15.28, "fmt": "15.28"},
                    "priceToSalesTrailing12Months": {},
                    "fiftyDayAverage": {"raw": 14.680572, "fmt": "14.68"},
                    "twoHundredDayAverage": {"raw": 14.265363, "fmt": "14.27"},
                    "trailingAnnualDividendRate": {},
                    "trailingAnnualDividendYield": {},
                    "navPrice": {},
                    "currency": "USD",
                    "fromCurrency": None,
                    "toCurrency": None,
                    "lastMarket": None,
                    "volume24Hr": {},
                    "volumeAllCurrencies": {},
                    "circulatingSupply": {},
                    "algorithm": None,
                    "maxSupply": {},
                    "startDate": {},
                    "tradeable": False,
                },
                "price": {
                    "maxAge": 1,
                    "preMarketChange": {},
                    "preMarketPrice": {},
                    "postMarketChange": {},
                    "postMarketPrice": {},
                    "regularMarketChangePercent": {
                        "raw": 0.0026595744,
                        "fmt": "0.27%",
                    },
                    "regularMarketChange": {"raw": 0.04, "fmt": "0.04"},
                    "regularMarketTime": 1597276823,
                    "priceHint": {"raw": 2, "fmt": "2", "longFmt": "2"},
                    "regularMarketPrice": {"raw": 15.08, "fmt": "15.08"},
                    "regularMarketDayHigh": {},
                    "regularMarketDayLow": {},
                    "regularMarketVolume": {},
                    "averageDailyVolume10Day": {
                        "raw": 0,
                        "fmt": None,
                        "longFmt": "0",
                    },
                    "averageDailyVolume3Month": {
                        "raw": 0,
                        "fmt": None,
                        "longFmt": "0",
                    },
                    "regularMarketPreviousClose": {
                        "raw": 15.04,
                        "fmt": "15.04",
                    },
                    "regularMarketSource": "DELAYED",
                    "regularMarketOpen": {},
                    "strikePrice": {},
                    "openInterest": {},
                    "exchange": "NAS",
                    "exchangeName": "Nasdaq",
                    "exchangeDataDelayedBy": 0,
                    "marketState": "POSTPOST",
                    "quoteType": "MUTUALFUND",
                    "symbol": "HBLFX",
                    "underlyingSymbol": None,
                    "shortName": "The Hartford Balanced Income Fu",
                    "longName": "The Hartford Balanced Income Fund Class F",
                    "currency": "USD",
                    "quoteSourceName": "Delayed Quote",
                    "currencySymbol": "$",
                    "fromCurrency": None,
                    "toCurrency": None,
                    "lastMarket": None,
                    "volume24Hr": {},
                    "volumeAllCurrencies": {},
                    "circulatingSupply": {},
                    "marketCap": {},
                },
            }
        ],
        "error": None,
    }
}

CAD_USD_REPONSE = {
    "spark": {
        "result": [
            {
                "symbol": "CADUSD=X",
                "response": [
                    {
                        "meta": {
                            "currency": "USD",
                            "symbol": "CADUSD=X",
                            "exchangeName": "CCY",
                            "instrumentType": "CURRENCY",
                            "firstTradeDate": 1063753200,
                            "regularMarketTime": 1597288995,
                            "gmtoffset": 3600,
                            "timezone": "BST",
                            "exchangeTimezoneName": "Europe/London",
                            "regularMarketPrice": 0.7555,
                            "chartPreviousClose": 0.7546,
                            "previousClose": 0.7546,
                            "scale": 4,
                            "priceHint": 4,
                            "currentTradingPeriod": {
                                "pre": {
                                    "timezone": "BST",
                                    "start": 1597273200,
                                    "end": 1597273200,
                                    "gmtoffset": 3600,
                                },
                                "regular": {
                                    "timezone": "BST",
                                    "start": 1597273200,
                                    "end": 1597359540,
                                    "gmtoffset": 3600,
                                },
                                "post": {
                                    "timezone": "BST",
                                    "start": 1597359540,
                                    "end": 1597359540,
                                    "gmtoffset": 3600,
                                },
                            },
                            "dataGranularity": "5m",
                            "range": "1m",
                            "validRanges": [
                                "1d",
                                "5d",
                                "1mo",
                                "3mo",
                                "6mo",
                                "1y",
                                "2y",
                                "5y",
                                "10y",
                                "ytd",
                                "max",
                            ],
                        },
                        "indicators": {"quote": [{}]},
                    }
                ],
            }
        ],
        "error": None,
    }
}
