Price Spectre
1.0
|
A publicly available class that exposes Price Spectre functionality.
averageX | ( | $x, | |
$reuseSearchResults = false |
|||
) |
Performs pre-defined x Average algorithm.
Performs a search based on the current search parameters and then performs the "x Average" algorithm. Returns the total price based on "x Average".
x | Specifies the number of search results to average. |
reuseSearchResults | Optional. When specified and true reuse the search most recently performed When not specified or false generate a new search |
debugMessage | ( | $message | ) |
Adds debug message. Append message to any previously debug messages.
If this is called at anytime during execution this will become an error message and may be reported the user.
message | Debug message that will be returned as an error once script ends. |
delete | ( | $index | ) |
Deletes a listing from the results set.
This function does not actually delete the listing but prevents Price Spectre from considering it in the final results (e.g. reporting, reprice history, etc.). Calling this function will affect the values returned by PS::getRealResults() and PS::getRealNumResults(). Calling this function also makes Listing::isDeleted() return TRUE.
This may be useful in situations where a search parameter is not sufficient to filter out a particular type of listing.
index | Specifies which result to remove from the results set. |
elastic | ( | $x | ) |
Performs pre-defined Elastic algorithm.
x | Specifies the minimum number of days to look back in evaluating the algorithm. |
getCeilingPrice | ( | ) |
Retrieves the total ceiling price of the seller's listing. This amount is inclusive of shipping charges unless shipping and handling charges are being ignored.
getCurrentPrice | ( | ) |
Returns the current price of the listing.
getData | ( | ) |
Retrieves user data for the listing.
A string of up to 255 characters can be stored containing any user-defined data or state information.
Examples of possible data could be information regarding the current or past state of the listing or additional variables.
getErrorMessage | ( | ) |
Returns error message for last call to PS::performSearch().
getFloorPrice | ( | ) |
Retrieves the total floor price of the seller's listing. This amount is inclusive of shipping charges unless shipping and handling charges are being ignored.
getGoldAsk | ( | $currency, | |
$unit | |||
) |
Retrieves the current ask price for gold bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getGoldBid | ( | $currency, | |
$unit | |||
) |
Retrieves the current bid price for gold bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getLastPriceChangePrice | ( | ) |
Retrieves the last price that the listing was set to. This should be equal to PS::getCurrentPrice();
getLastPriceChangeTime | ( | ) |
Retrieves the epoch time of the last price change for the listing.
getLastSaleTime | ( | ) |
Retrieves the epoch time of the last time a sale was made for the listing.
getListingID | ( | ) |
Retrieves the item number of the listing.
getMyAmazonPrice | ( | ) |
Checks Amazon for the seller's own Amazon price based on ASIN.
Performs an ASIN search against the seller's own Amazon account. If a product is found return its price. Otherwise, throw an exception. The ASIN is retrieved from the Product Code or Keywords search parameter. Useful for maintaining price parity.
getNoCompetitionFound | ( | ) |
Checks whether no competitors were found during last search performed.
getNumResults | ( | ) |
Retrieves the number of competitor listings found. Deleted listings are included in the count.
getNumSales | ( | $start = 0 , |
|
$end = 2147483647 |
|||
) |
Retrieves the quantity sold between two epoch times.
start | Specifies the epoch time to begin counting sales. If not specified a default of 0 is used. |
end | Specifies the epoch time to stop counting sales. If not specified a default of 2147483647 is used. |
getNumSalesSince | ( | $seconds | ) |
Retrieves the quantity sold during the past number of seconds.
seconds | Specifies the number of seconds in the past to begin counting sales. |
getPalladiumAsk | ( | $currency, | |
$unit | |||
) |
Retrieves the current ask price for palladium bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getPalladiumBid | ( | $currency, | |
$unit | |||
) |
Retrieves the current bid price for palladium bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getPlatinumAsk | ( | $currency, | |
$unit | |||
) |
Retrieves the current ask price for platinum bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getPlatinumBid | ( | $currency, | |
$unit | |||
) |
Retrieves the current bid price for platinum bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getQuantity | ( | ) |
Retrieves the quantity available of the listing.
getRank | ( | $price | ) |
Retrieves the rank achieved at a given price based on the competitors found.
price | Specifies the price to check rank against. |
getRealNumResults | ( | ) |
Retrieves the actual number of competitor listings found. Deleted listings are ignored in the count.
getRealRank | ( | $price | ) |
Retrieves the rank achieved at a given price based on the competitors found. Deleted listings are ignored in the count.
price | Specifies the price to check rank against. |
getRealResults | ( | ) |
Retrieves an array of class Listing representing the actual competitor listings found. Deleted listings are ignored.
getResults | ( | ) |
Retrieves an array of class Listing representing the actual competitor listings found.
getSearchParameter | ( | $key | ) |
Retrieves a specified search parameter.
key | Specifies the search parameter to retrieve. Possible values: 'keywords', 'productCode', 'minFeedback', 'maxFeedback', 'minPrice', 'maxPrice', 'minQty', 'maxQty', 'maxHandlingTime', 'includeSellers', 'excludeSellers', 'exemptSellers', 'ebayFixedprice', 'ebayAuctions', 'findAmazon', 'domestic', 'hideDuplicates', 'trs', 'returnsAccepted', 'restrictCategory', 'searchCategory', 'searchCondition', 'binPrice', 'floorPrice', 'ceilPrice', 'postalCodeUS', 'destination', 'valueBox' |
getSecondsRemaining | ( | ) |
Retrieves the number of seconds before the listing will end.
getSecondsSinceLastPriceChange | ( | ) |
Retrieves the number of seconds since the last price change.
getSecondsSinceStart | ( | ) |
Retrieves the number of seconds since the listing has started.
getShippingHandling | ( | ) |
Retrieves the shipping and handling charges for the seller's listing.
getSilverAsk | ( | $currency, | |
$unit | |||
) |
Retrieves the current ask price for silver bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getSilverBid | ( | $currency, | |
$unit | |||
) |
Retrieves the current bid price for silver bullion.
currency | Specifies the currency to retrieve price in. Possible values: 'USD', 'GBP', 'EUR', 'AUD', 'CAD' |
unit | Specifies the mass unit. Possible values: 'kg', 'g', 'gr', 'ozt', 'troy' |
getSiteCountry | ( | ) |
Retrieves the country associated with the eBay site the item was listed to.
overrideNoCompetitionFound | ( | ) |
Tells Price Spectre to not apply its own logic during the "No competition found" situation.
By default Price Spectre will override any prices set if the last search performed results in no competitor listings being found. The price set can be configured via the "No competition found" behavior.
Make a call to this function if you wish to provide your own logic for handling this situation and prevent Price Spectre from applying its own. This can be called at any time.
performSafeSearch | ( | ) |
Performs a search based on the given search parameters.
This function differs from PS::performSearch() in that if a failure occurs execution of algorithm will immediately terminate with the appropriate error message.
After the search is performed make a call to PS::getResults() and PS::getNumResults() to retrieve the search results and number of results found.
performSearch | ( | ) |
Performs a search based on the given search parameters.
After the search is performed make a call to PS::getResults() and PS::getNumResults() to retrieve the search results and number of results found.
The user must make their own accommodations in the case that the search fails. See PS::performSafeSearch() for an identical function that doesn't have this requirement.
performSelfSafeSearch | ( | ) |
Performs a self search on Amazon.
This function differs from PS::performSelfSearch() in that if a failure occurs execution of algorithm will immediately terminate with the appropriate error message.
After the search is performed make a call to PS::getResults() and PS::getNumResults() to retrieve the search results and number of results found.
performSelfSearch | ( | ) |
Performs a self search on Amazon.
After the search is performed make a call to PS::getResults() and PS::getNumResults() to retrieve the search results and number of results found.
The user must make their own accommodations in the case that the search fails. See PS::performSelfSafeSearch() for an identical function that doesn't have this requirement.
setPrice | ( | $price | ) |
Sets the total price of the listing.
If this function is not called within the algorithm the final price will remain at its current level.
By default if no competitor listings are found with the last search performed then the final price would also be overridden based on "No competition found" behavior that was set. This can be avoided by making a call to PS::overrideNoCompetitionFound().
price | Specifies the total price to set the listing to. |
setSearchParameter | ( | $key, | |
$value | |||
) |
Sets a specified search parameter.
key | Specifies the search parameter to set. Possible values: 'keywords', 'productCode', 'minFeedback', 'maxFeedback', 'minPrice', 'maxPrice', 'minQty', 'maxQty', 'maxHandlingTime', 'includeSellers', 'excludeSellers', 'exemptSellers', 'ebayFixedprice', 'ebayAuctions', 'findAmazon', 'domestic', 'hideDuplicates', 'trs', 'returnsAccepted', 'restrictCategory', 'searchCategory', 'searchCondition', 'binPrice', 'floorPrice', 'ceilPrice', 'postalCodeUS', 'destination', 'valueBox' |
value | Specifies the new value for the search parameter. |
writeData | ( | $str | ) |
Writes user data to the database for the listing.
A string of up to 255 characters can be stored containing any user-defined data or state information.
Examples of possible data could be information regarding the current or past state of the listing or additional variables.
str | Specifies a string to store as data for the listing. |
xLowestY | ( | $x, | |
$y, | |||
$reuseSearchResults = false |
|||
) |
Performs pre-defined "x lowest by $y" algorithm
Performs a search based on the current search parameters and then performs the "x lowest by $y" algorithm. Returns the total price based on "x lowest by $y".
x | Specifies which search result to match against. ex: 1 matches against the lowest price, 2 matches against the second lowest price, etc. |
y | Specifies the amount to discount the Xth lowest price. Positive values of Y result in pricing below the Xth lowest price. A zero value of Y results in matching the Xth lowest price. Negative values of Y result in pricing above the Xth lowest price. |
reuseSearchResults | Optional. When specified and true reuse the search most recently performed When not specified or false generate a new search |
xLowestYPercent | ( | $x, | |
$y, | |||
$reuseSearchResults = false |
|||
) |
Performs pre-defined "x lowest y%" algorithm.
Performs a search based on the current search parameters and then performs the "x lowest y%" algorithm. Returns the total price based on "x lowest y%".
x | Specifies which search result to match against. ex: 1 matches against the lowest price, 2 matches against the second lowest price, etc. |
y | Specifies the percentage to discount the Xth lowest price. Positive values of Y result in pricing below the Xth lowest price. A zero value of Y results in matching the Xth lowest price. Negative values of Y result in pricing above the Xth lowest price. |
reuseSearchResults | Optional. When specified and true reuse the search most recently performed When not specified or false generate a new search |