Skip to content

USDAFruitAndVegetable

QuantConnect.DataSource.USDAFruitAndVegetable

USDAFruitAndVegetable()

Bases: BaseData

USDAFruitAndVegetable - Individual data point for USDA ERS retail price estimates. Contains price data for a specific product form (Fresh, Canned, Frozen, etc.).

Constructor for initialising the dase data class

form

form: str

Product form identifier (e.g., "Fresh", "Canned", "Fresh - Florets").

average_retail_price

average_retail_price: Optional[float]

Average retail price per unit (pound or pint).

unit

unit: Optional[PriceUnit]

Unit of measure - PerPound (solids) or PerPint (juice).

preparation_yield_factor

preparation_yield_factor: Optional[float]

Fraction of product that is edible after preparation (0.0-1.0).

cup_equivalent_size

cup_equivalent_size: Optional[float]

Size of one edible cup equivalent.

cup_equivalent_unit

cup_equivalent_unit: Optional[CupEquivalentUnit]

Unit of measure for cup_equivalent_size.

price_per_cup_equivalent

price_per_cup_equivalent: Optional[float]

Normalized price per edible cup equivalent (comparable across forms).

value

value: float

Returns the primary value (PricePerCupEquivalent), or 0 if null.

symbol

symbol: Symbol

Symbol representation for underlying Security

data_type

data_type: MarketDataType

Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC.

time

time: datetime

Current time marker of this data packet.

end_time

end_time: datetime

The end time of this data. Some data covers spans (trade bars) and as such we want to know the entire time span covered

price

price: float

As this is a backtesting platform we'll provide an alias of value as price.

ALL_RESOLUTIONS

ALL_RESOLUTIONS: List[Resolution] = ...

A list of all Resolution

This codeEntityType is protected.

DAILY_RESOLUTION

DAILY_RESOLUTION: List[Resolution] = ...

A list of Resolution.DAILY

This codeEntityType is protected.

MINUTE_RESOLUTION

MINUTE_RESOLUTION: List[Resolution] = ...

A list of Resolution.MINUTE

This codeEntityType is protected.

HIGH_RESOLUTION

HIGH_RESOLUTION: List[Resolution] = ...

A list of high Resolution, including minute, second, and tick.

This codeEntityType is protected.

OPTION_RESOLUTIONS

OPTION_RESOLUTIONS: List[Resolution] = ...

A list of resolutions support by Options

This codeEntityType is protected.

is_fill_forward

is_fill_forward: bool

True if this is a fill forward piece of data

Symbols

Bases: Object

Product symbols for USDA Fruit and Vegetables data. AddData(USDAFruitAndVegetable.Symbols.Apples)

ACORN_SQUASH

ACORN_SQUASH: str

Acorn squash

APPLES

APPLES: str

Apples

APRICOTS

APRICOTS: str

Apricots

ARTICHOKE

ARTICHOKE: str

Artichoke

ASPARAGUS

ASPARAGUS: str

Asparagus

AVOCADOS

AVOCADOS: str

Avocados

BANANAS

BANANAS: str

Bananas

BEETS

BEETS: str

Beets

BLACK_BEANS

BLACK_BEANS: str

Black beans

BLACKBERRIES

BLACKBERRIES: str

Blackberries

BLACKEYE_PEAS

BLACKEYE_PEAS: str

Blackeye peas

BLUEBERRIES

BLUEBERRIES: str

Blueberries

BROCCOLI

BROCCOLI: str

Broccoli

BRUSSELS_SPROUTS

BRUSSELS_SPROUTS: str

Brussels sprouts

BUTTERNUT_SQUASH

BUTTERNUT_SQUASH: str

Butternut squash

CABBAGE

CABBAGE: str

Cabbage

CANTALOUPE

CANTALOUPE: str

Cantaloupe

CARROTS

CARROTS: str

Carrots

CAULIFLOWER

CAULIFLOWER: str

Cauliflower

CELERY

CELERY: str

Celery

CHERRIES

CHERRIES: str

Cherries

CLEMENTINES

CLEMENTINES: str

Clementines

COLLARD_GREENS

COLLARD_GREENS: str

Collard greens

CRANBERRIES

CRANBERRIES: str

Cranberries

CUCUMBERS

CUCUMBERS: str

Cucumbers

DATES

DATES: str

Dates

FIGS

FIGS: str

Figs

FRUIT_COCKTAIL

FRUIT_COCKTAIL: str

Fruit cocktail

GRAPEFRUIT

GRAPEFRUIT: str

Grapefruit

GRAPES

GRAPES: str

Grapes

GREAT_NORTHERN_BEANS

GREAT_NORTHERN_BEANS: str

Great northern beans

GREEN_BEANS

GREEN_BEANS: str

Green beans

GREEN_PEAS

GREEN_PEAS: str

Green peas

GREEN_PEPPERS

GREEN_PEPPERS: str

Green peppers

HONEYDEW_MELON

HONEYDEW_MELON: str

Honeydew melon

ICEBERG_LETTUCE

ICEBERG_LETTUCE: str

Iceberg lettuce

KALE

KALE: str

Kale

KIDNEY_BEANS

KIDNEY_BEANS: str

Kidney beans

KIWI

KIWI: str

Kiwi

LENTILS

LENTILS: str

Lentils

LIMA_BEANS

LIMA_BEANS: str

Lima beans

MANGOES

MANGOES: str

Mangoes

MIXED_BERRIES

MIXED_BERRIES: str

Mixed berries

MIXED_VEGETABLES

MIXED_VEGETABLES: str

Mixed vegetables

MUSHROOMS

MUSHROOMS: str

Mushrooms

MUSTARD_GREENS

MUSTARD_GREENS: str

Mustard greens

NAVY_BEANS

NAVY_BEANS: str

Navy beans

NECTARINES

NECTARINES: str

Nectarines

OKRA

OKRA: str

Okra

OLIVES

OLIVES: str

Olives

ONIONS

ONIONS: str

Onions

ORANGES

ORANGES: str

Oranges

PAPAYA

PAPAYA: str

Papaya

PEACHES

PEACHES: str

Peaches

PEARS

PEARS: str

Pears

PINEAPPLE

PINEAPPLE: str

Pineapple

PINTO_BEANS

PINTO_BEANS: str

Pinto beans

PLUMS

PLUMS: str

Plums

POMEGRANATE

POMEGRANATE: str

Pomegranate

POTATOES

POTATOES: str

Potatoes

PUMPKIN

PUMPKIN: str

Pumpkin

RADISH

RADISH: str

Radish

RASPBERRIES

RASPBERRIES: str

Raspberries

RED_PEPPERS

RED_PEPPERS: str

Red peppers

ROMAINE_LETTUCE

ROMAINE_LETTUCE: str

Romaine lettuce

SPINACH

SPINACH: str

Spinach

STRAWBERRIES

STRAWBERRIES: str

Strawberries

SUMMER_SQUASH

SUMMER_SQUASH: str

Summer squash

SWEET_CORN

SWEET_CORN: str

Sweet corn

SWEET_POTATOES

SWEET_POTATOES: str

Sweet potatoes

TANGERINES

TANGERINES: str

Tangerines

TOMATOES

TOMATOES: str

Tomatoes

TURNIP_GREENS

TURNIP_GREENS: str

Turnip greens

WATERMELON

WATERMELON: str

Watermelon

ZUCCHINI

ZUCCHINI: str

Zucchini

clone

clone() -> BaseData

Creates a clone of this instance

Returns:

Type Description
BaseData

A clone of this instance.

data_time_zone

data_time_zone() -> Any

Gets the data timezone for this data

Returns:

Type Description
Any

The timezone.

default_resolution

default_resolution() -> Resolution

Gets the default resolution for this data

Returns:

Type Description
Resolution

The default resolution.

is_sparse_data

is_sparse_data() -> bool

Indicates whether this is sparse data

Returns:

Type Description
bool

True if sparse, false otherwise.

reader

reader(
    config: SubscriptionDataConfig,
    line: str,
    date: datetime,
    is_live_mode: bool,
) -> BaseData

Read and parse the data from a line

Parameters:

Name Type Description Default
config SubscriptionDataConfig

Subscription data config

required
line str

Line of data

required
date datetime

Date of the data

required
is_live_mode bool

Is this live mode

required

Returns:

Type Description
BaseData

Parsed data object.

requires_mapping

requires_mapping() -> bool

Indicates whether this data requires mapping

Returns:

Type Description
bool

True if requires mapping, false otherwise.

supported_resolutions

supported_resolutions() -> List[Resolution]

Gets the supported resolutions for this data

Returns:

Type Description
List[Resolution]

List of supported resolutions.

to_string

to_string() -> str

Returns a string representation of this data

Returns:

Type Description
str

String representation.

deserialize_message

deserialize_message(serialized: str) -> Sequence[BaseData]

Deserialize the message from the data server

Parameters:

Name Type Description Default
serialized str

The data server's message

required

Returns:

Type Description
Sequence[BaseData]

An enumerable of base data, if unsuccessful, returns an empty enumerable.

get_source

get_source(
    config: SubscriptionDataConfig,
    date: datetime,
    is_live_mode: bool,
) -> SubscriptionDataSource

Return the URL string source of the file. This will be converted to a stream

Parameters:

Name Type Description Default
config SubscriptionDataConfig

Configuration object

required
date datetime

Date of this source file

required
is_live_mode bool

true if we're in live mode, false for backtesting mode

required

Returns:

Type Description
SubscriptionDataSource

String URL of source file.

should_cache_to_security

should_cache_to_security() -> bool

Indicates whether this contains data that should be stored in the security cache

Returns:

Type Description
bool

Whether this contains data that should be stored in the security cache.

update

update(
    last_trade: float,
    bid_price: float,
    ask_price: float,
    volume: float,
    bid_size: float,
    ask_size: float,
) -> None

Update routine to build a bar/tick from a data update.

Parameters:

Name Type Description Default
last_trade float

The last trade price

required
bid_price float

Current bid price

required
ask_price float

Current asking price

required
volume float

Volume of this trade

required
bid_size float

The size of the current bid, if available

required
ask_size float

The size of the current ask, if available

required

update_ask

update_ask(ask_price: float, ask_size: float) -> None

Updates this base data with the new quote ask information

Parameters:

Name Type Description Default
ask_price float

The current ask price

required
ask_size float

The current ask size

required

update_bid

update_bid(bid_price: float, bid_size: float) -> None

Updates this base data with the new quote bid information

Parameters:

Name Type Description Default
bid_price float

The current bid price

required
bid_size float

The current bid size

required

update_quote

update_quote(
    bid_price: float,
    bid_size: float,
    ask_price: float,
    ask_size: float,
) -> None

Updates this base data with new quote information

Parameters:

Name Type Description Default
bid_price float

The current bid price

required
bid_size float

The current bid size

required
ask_price float

The current ask price

required
ask_size float

The current ask size

required

update_trade

update_trade(last_trade: float, trade_size: float) -> None

Updates this base data with a new trade

Parameters:

Name Type Description Default
last_trade float

The price of the last trade

required
trade_size float

The quantity traded

required