localbitcoins

package
v0.0.0-...-83dca6d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2022 License: MIT Imports: 30 Imported by: 0

README

GoCryptoTrader package Localbitcoins

Build Status Software License GoDoc Coverage Status Go Report Card

This localbitcoins package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

LocalBitcoins Exchange

Current Features
  • REST Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var l exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "LocalBitcoins" {
		l = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := l.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := l.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := l.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := l.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := l.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
	// Handle error
}
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Username              string `json:"username"`
	FeedbackScore         int    `json:"feedback_score"`
	FeedbackCount         int    `json:"feedback_count"`
	RealNameVeriTrusted   int    `json:"real_name_verifications_trusted"`
	TradingPartners       int    `json:"trading_partners_count"`
	URL                   string `json:"url"`
	RealNameVeriUntrusted int    `json:"real_name_verifications_untrusted"`
	HasFeedback           bool   `json:"has_feedback"`
	IdentityVerifiedAt    string `json:"identify_verified_at"`
	TrustedCount          int    `json:"trusted_count"`
	FeedbacksUnconfirmed  int    `json:"feedbacks_unconfirmed_count"`
	BlockedCount          int    `json:"blocked_count"`
	TradeVolumeText       string `json:"trade_volume_text"`
	HasCommonTrades       bool   `json:"has_common_trades"`
	RealNameVeriRejected  int    `json:"real_name_verifications_rejected"`
	AgeText               string `json:"age_text"`
	ConfirmedTradesText   string `json:"confirmed_trade_count_text"`
	CreatedAt             string `json:"created_at"`
}

AccountInfo holds public user information

type AdCreate

type AdCreate struct {
	// Required Arguments
	PriceEquation              string `json:"price_equation"`
	Latitude                   int    `json:"lat"`
	Longitude                  int    `json:"lon"`
	City                       string `json:"city"`
	Location                   string `json:"location_string"`
	CountryCode                string `json:"countrycode"`
	Currency                   string `json:"currency"`
	AccountInfo                string `json:"account_info"`
	BankName                   string `json:"bank_name"`
	MSG                        string `json:"msg"`
	SMSVerficationRequired     bool   `json:"sms_verification_required"`
	TrackMaxAmount             bool   `json:"track_max_amount"`
	RequireTrustedByAdvertiser bool   `json:"require_trusted_by_advertiser"`
	RequireIdentification      bool   `json:"require_identification"`
	OnlineProvider             string `json:"online_provider"`
	TradeType                  string `json:"trade_type"`

	// Optional Arguments
	MinAmount          int      `json:"min_amount"`
	MaxAmount          int      `json:"max_amount"`
	OpeningHours       []string `json:"opening_hours"`
	LimitToFiatAmounts string   `json:"limit_to_fiat_amounts"`
	Visible            bool     `json:"visible"`

	// Optional Arguments ONLINE_SELL ads
	RequireTradeVolume   int    `json:"require_trade_volume"`
	RequireFeedBackScore int    `json:"require_feedback_score"`
	FirstTimeLimitBTC    int    `json:"first_time_limit_btc"`
	VolumeCoefficientBTC int    `json:"volume_coefficient_btc"`
	ReferenceType        string `json:"reference_type"`
	DisplayReference     bool   `json:"display_reference"`

	// Optional Arguments ONLINE_BUY
	PaymentWindowMinutes int `json:"payment_window_minutes"`

	// Optional Arguments LOCAL_SELL
	Floating bool `json:"floating"`
}

AdCreate references an outgoing paramater type for CreateAd() method

type AdData

type AdData struct {
	AdList []struct {
		Data struct {
			Visible                    bool        `json:"visible"`
			HiddenByOpeningHours       bool        `json:"hidden_by_opening_hours"`
			Location                   string      `json:"location_string"`
			CountryCode                string      `json:"countrycode"`
			City                       string      `json:"city"`
			TradeType                  string      `json:"trade_type"`
			OnlineProvider             string      `json:"online_provider"`
			FirstTimeLimitBTC          string      `json:"first_time_limit_btc"`
			VolumeCoefficientBTC       string      `json:"volume_coefficient_btc"`
			SMSVerficationRequired     bool        `json:"sms_verification_required"`
			ReferenceType              string      `json:"reference_type"`
			DisplayReference           bool        `json:"display_reference"`
			Currency                   string      `json:"currency"`
			Lat                        float64     `json:"lat"`
			Lon                        float64     `json:"lon"`
			MinAmount                  string      `json:"min_amount"`
			MaxAmount                  string      `json:"max_amount"`
			MaXAmountAvailable         string      `json:"max_amount_available"`
			LimitToFiatAmounts         string      `json:"limit_to_fiat_amounts"`
			AdID                       int64       `json:"ad_id"`
			TempPriceUSD               string      `json:"temp_price_usd"`
			Floating                   bool        `json:"floating"`
			Profile                    interface{} `json:"profile"`
			RequireFeedBackScore       int         `json:"require_feedback_score"`
			RequireTradeVolume         float64     `json:"require_trade_volume"`
			RequireTrustedByAdvertiser bool        `json:"require_trusted_by_advertiser"`
			PaymentWindowMinutes       int         `json:"payment_window_minutes"`
			BankName                   string      `json:"bank_name"`
			TrackMaxAmount             bool        `json:"track_max_amount"`
			ATMModel                   string      `json:"atm_model"`
			PriceEquation              string      `json:"price_equation"`
			OpeningHours               interface{} `json:"opening_hours"`
			AccountInfo                string      `json:"account_info"`
			AccountDetails             interface{} `json:"account_details"`
		} `json:"data"`
		Actions struct {
			PublicView  string `json:"public_view"`
			HTMLEdit    string `json:"html_edit"`
			ChangeForm  string `json:"change_form"`
			ContactForm string `json:"contact_form"`
		} `json:"actions"`
	} `json:"ad_list"`
	AdCount int `json:"ad_count"`
}

AdData references the full possible return of ad data

type AdEdit

type AdEdit struct {
	// Required Arguments
	PriceEquation              string `json:"price_equation"`
	Latitude                   int    `json:"lat"`
	Longitude                  int    `json:"lon"`
	City                       string `json:"city"`
	Location                   string `json:"location_string"`
	CountryCode                string `json:"countrycode"`
	Currency                   string `json:"currency"`
	AccountInfo                string `json:"account_info"`
	BankName                   string `json:"bank_name"`
	MSG                        string `json:"msg"`
	SMSVerficationRequired     bool   `json:"sms_verification_required"`
	TrackMaxAmount             bool   `json:"track_max_amount"`
	RequireTrustedByAdvertiser bool   `json:"require_trusted_by_advertiser"`
	RequireIdentification      bool   `json:"require_identification"`

	// Optional Arguments
	MinAmount          int      `json:"min_amount"`
	MaxAmount          int      `json:"max_amount"`
	OpeningHours       []string `json:"opening_hours"`
	LimitToFiatAmounts string   `json:"limit_to_fiat_amounts"`
	Visible            bool     `json:"visible"`

	// Optional Arguments ONLINE_SELL ads
	RequireTradeVolume   int    `json:"require_trade_volume"`
	RequireFeedBackScore int    `json:"require_feedback_score"`
	FirstTimeLimitBTC    int    `json:"first_time_limit_btc"`
	VolumeCoefficientBTC int    `json:"volume_coefficient_btc"`
	ReferenceType        string `json:"reference_type"`
	DisplayReference     bool   `json:"display_reference"`

	// Optional Arguments ONLINE_BUY
	PaymentWindowMinutes int `json:"payment_window_minutes"`

	// Optional Arguments LOCAL_SELL
	Floating bool `json:"floating"`
}

AdEdit references an outgoing paramater type for EditAd() method

type Balance

type Balance struct {
	Balance  float64 `json:"balance,string"`
	Sendable float64 `json:"Sendable,string"`
}

Balance is a sub-type for WalletInfo & WalletBalanceInfo

type DashBoardInfo

type DashBoardInfo struct {
	Data struct {
		CreatedAt string `json:"created_at"`
		Buyer     struct {
			Username                 string `json:"username"`
			TradeCount               string `json:"trade_count"`
			FeedbackScore            int    `json:"feedback_score"`
			Name                     string `json:"name"`
			LastOnline               string `json:"last_online"`
			RealName                 string `json:"real_name"`
			CompanyName              string `json:"company_name"`
			CountryCodeByIP          string `json:"countrycode_by_ip"`
			CountryCodeByPhoneNUmber string `json:"countrycode_by_phone_number"`
		} `json:"buyer"`
		Seller struct {
			Username      string `json:"username"`
			TradeCount    string `json:"trade_count"`
			FeedbackScore int    `json:"feedback_score"`
			Name          string `json:"name"`
			LastOnline    string `json:"last_online"`
		} `json:"seller"`
		ReferenceCode         string  `json:"reference_code"`
		Currency              string  `json:"currency"`
		Amount                float64 `json:"amount,string"`
		AmountBTC             float64 `json:"amount_btc,string"`
		FeeBTC                float64 `json:"fee_btc,string"`
		ExchangeRateUpdatedAt string  `json:"exchange_rate_updated_at"`
		Advertisement         struct {
			ID         int    `json:"id"`
			TradeType  string `json:"trade_type"`
			Advertiser struct {
				Username      string `json:"username"`
				TradeCount    string `json:"trade_count"`
				FeedbackScore int    `json:"feedback_score"`
				Name          string `json:"name"`
				LastOnline    string `json:"last_online"`
			} `json:"advertiser"`
		} `json:"advertisement"`
		ContactID          int         `json:"contact_id"`
		CanceledAt         string      `json:"canceled_at"`
		EscrowedAt         string      `json:"escrowed_at"`
		FundedAt           string      `json:"funded_at"`
		PaymentCompletedAt string      `json:"payment_completed_at"`
		DisputedAt         string      `json:"disputed_at"`
		ClosedAt           string      `json:"closed_at"`
		ReleasedAt         string      `json:"released_at"`
		IsBuying           bool        `json:"is_buying"`
		IsSelling          bool        `json:"is_selling"`
		AccountDetails     interface{} `json:"account_details"`
		AccountInfo        string      `json:"account_info"`
		Floating           bool        `json:"floating"`
	} `json:"data"`
	Actions struct {
		MarkAsPaidURL           string `json:"mark_as_paid_url"`
		AdvertisementPublicView string `json:"advertisement_public_view"`
		MessageURL              string `json:"message_url"`
		MessagePostURL          string `json:"message_post_url"`
	} `json:"actions"`
}

DashBoardInfo holds the full range of metadata for a dashboard image

type GeneralError

type GeneralError struct {
	Error struct {
		Message   string `json:"message"`
		ErrorCode int    `json:"error_code"`
	} `json:"error"`
}

GeneralError is an error capture type

type Invoice

type Invoice struct {
	Invoice struct {
		Description     string  `json:"description"`
		Created         string  `json:"created"`
		URL             string  `json:"url"`
		Amount          float64 `json:"amount,string"`
		Internal        bool    `json:"internal"`
		Currency        string  `json:"currency"`
		State           string  `json:"state"`
		ID              string  `json:"id"`
		BTCAmount       string  `json:"btc_amount"`
		BTCAddress      string  `json:"btc_address"`
		DeletingAllowed bool    `json:"deleting_allowed"`
	} `json:"invoice"`
}

Invoice contains invoice data

type LocalBitcoins

type LocalBitcoins struct {
	exchange.Base
}

LocalBitcoins is the overarching type across the localbitcoins package

func (*LocalBitcoins) CancelAllOrders

func (l *LocalBitcoins) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*LocalBitcoins) CancelBatchOrders

func (l *LocalBitcoins) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*LocalBitcoins) CancelOrder

func (l *LocalBitcoins) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*LocalBitcoins) CancelTrade

func (l *LocalBitcoins) CancelTrade(ctx context.Context, contactID string) error

CancelTrade cancels the trade if the token owner is the Bitcoin buyer. Bitcoin sellers cannot cancel trades.

func (*LocalBitcoins) CheckPincode

func (l *LocalBitcoins) CheckPincode(ctx context.Context, pin int) (bool, error)

CheckPincode checks the given PIN code against the token owners currently active PIN code. You can use this method to ensure the person using the session is the legitimate user. Due to only requiring the read scope, the user is not guaranteed to have set a PIN code. If you protect your application using this request, please make the user has set a PIN code for his account.

func (*LocalBitcoins) ConfirmRealName

func (l *LocalBitcoins) ConfirmRealName(ctx context.Context, contactID string) error

ConfirmRealName creates or updates real name confirmation.

func (*LocalBitcoins) CreateAd

func (l *LocalBitcoins) CreateAd(ctx context.Context, _ *AdCreate) error

CreateAd creates a new advertisement

params - see localbitcoins_types.go AdCreate for reference TODO

func (*LocalBitcoins) CreateNewInvoice

func (l *LocalBitcoins) CreateNewInvoice(ctx context.Context) error

CreateNewInvoice creates a new invoice. TODO

func (*LocalBitcoins) DeleteAd

func (l *LocalBitcoins) DeleteAd(ctx context.Context, adID string) error

DeleteAd deletes the advertisement by adID.

adID - string of specific ad identification TODO

func (*LocalBitcoins) DeleteInvoice

func (l *LocalBitcoins) DeleteInvoice(ctx context.Context) (Invoice, error)

DeleteInvoice deletes a specific invoice. Deleting invoices is possible when it is sure that receiver cannot accidentally pay the invoice at the same time as the merchant is deleting it. You can use the API request /api/merchant/invoice/{invoice_id}/ to check if deleting is possible. TODO

func (*LocalBitcoins) Dispute

func (l *LocalBitcoins) Dispute(ctx context.Context, _, contactID string) error

Dispute starts a dispute on the specified trade ID if the requirements for starting the dispute has been fulfilled.

topic - [optional] String Short description of issue to LocalBitcoins customer support. TODO

func (*LocalBitcoins) EditAd

func (l *LocalBitcoins) EditAd(ctx context.Context, _ *AdEdit, adID string) error

EditAd updates set advertisements

params - see localbitcoins_types.go AdEdit for reference adID - string for the ad you already created TODO

func (*LocalBitcoins) FetchAccountInfo

func (l *LocalBitcoins) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*LocalBitcoins) FetchOrderbook

func (l *LocalBitcoins) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*LocalBitcoins) FetchTicker

func (l *LocalBitcoins) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*LocalBitcoins) FetchTradablePairs

func (l *LocalBitcoins) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*LocalBitcoins) FundTrade

func (l *LocalBitcoins) FundTrade(ctx context.Context, contactID string) error

FundTrade attempts to fund an unfunded local trade from the token owners wallet. Works only if the token owner is the Bitcoin seller in the trade.

func (*LocalBitcoins) GetAccountInformation

func (l *LocalBitcoins) GetAccountInformation(ctx context.Context, username string, self bool) (AccountInfo, error)

GetAccountInformation lets you retrieve the public user information on a LocalBitcoins user. The response contains the same information that is found on an account's public profile page.

func (*LocalBitcoins) GetActiveOrders

func (l *LocalBitcoins) GetActiveOrders(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*LocalBitcoins) GetBitcoinsOnlineAd

func (l *LocalBitcoins) GetBitcoinsOnlineAd(ctx context.Context) error

GetBitcoinsOnlineAd this API returns buy or sell Bitcoin online ads. TODO

func (*LocalBitcoins) GetBitcoinsWithCashAd

func (l *LocalBitcoins) GetBitcoinsWithCashAd(ctx context.Context) error

GetBitcoinsWithCashAd returns buy or sell as cash local advertisements. TODO

func (*LocalBitcoins) GetCountryCodes

func (l *LocalBitcoins) GetCountryCodes(ctx context.Context) error

GetCountryCodes returns a list of valid and recognized countrycodes

func (*LocalBitcoins) GetCurrencies

func (l *LocalBitcoins) GetCurrencies(ctx context.Context) error

GetCurrencies returns a list of valid and recognized fiat currencies. Also contains human readable name for every currency and boolean that tells if currency is an altcoin.

func (*LocalBitcoins) GetDashboardCancelledTrades

func (l *LocalBitcoins) GetDashboardCancelledTrades(ctx context.Context) ([]DashBoardInfo, error)

GetDashboardCancelledTrades returns a list of all canceled trades where the token owner is either a buyer or seller.

func (*LocalBitcoins) GetDashboardClosedTrades

func (l *LocalBitcoins) GetDashboardClosedTrades(ctx context.Context) ([]DashBoardInfo, error)

GetDashboardClosedTrades returns a list of all closed trades where the token owner is either a buyer or seller.

func (*LocalBitcoins) GetDashboardInfo

func (l *LocalBitcoins) GetDashboardInfo(ctx context.Context) ([]DashBoardInfo, error)

GetDashboardInfo returns a list of trades on the data key contact_list. This API end point mirrors the website's dashboard, allowing access to contacts in different states. In addition all of these listings have buyer/ and seller/ sub-listings to view contacts where the token owner is either buying or selling, respectively. E.g. /api/dashboard/buyer/. All contacts where the token owner is participating are returned.

func (*LocalBitcoins) GetDashboardReleasedTrades

func (l *LocalBitcoins) GetDashboardReleasedTrades(ctx context.Context) ([]DashBoardInfo, error)

GetDashboardReleasedTrades returns a list of all released trades where the token owner is either a buyer or seller.

func (*LocalBitcoins) GetDefaultConfig

func (l *LocalBitcoins) GetDefaultConfig() (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*LocalBitcoins) GetDepositAddress

func (l *LocalBitcoins) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*LocalBitcoins) GetFee

func (l *LocalBitcoins) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*LocalBitcoins) GetFeeByType

func (l *LocalBitcoins) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*LocalBitcoins) GetFundingHistory

func (l *LocalBitcoins) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*LocalBitcoins) GetHistoricCandles

func (l *LocalBitcoins) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*LocalBitcoins) GetHistoricCandlesExtended

func (l *LocalBitcoins) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*LocalBitcoins) GetHistoricTrades

func (l *LocalBitcoins) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*LocalBitcoins) GetInvoice

func (l *LocalBitcoins) GetInvoice(ctx context.Context) (Invoice, error)

GetInvoice returns information about a specific invoice created by the token owner. TODO

func (*LocalBitcoins) GetMessages

func (l *LocalBitcoins) GetMessages(ctx context.Context, contactID string) (Message, error)

GetMessages returns all chat messages from the trade. Messages are on the message_list key.

func (*LocalBitcoins) GetNotifications

func (l *LocalBitcoins) GetNotifications(ctx context.Context) ([]NotificationInfo, error)

GetNotifications returns recent notifications.

func (*LocalBitcoins) GetOrderHistory

func (l *LocalBitcoins) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*LocalBitcoins) GetOrderInfo

func (l *LocalBitcoins) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*LocalBitcoins) GetOrderbook

func (l *LocalBitcoins) GetOrderbook(ctx context.Context, currency string) (Orderbook, error)

GetOrderbook returns buy and sell bitcoin online advertisements. Amount is the maximum amount available for the trade request. Price is the hourly updated price. The price is based on the price equation and commission % entered by the ad author.

func (*LocalBitcoins) GetPaymentMethods

func (l *LocalBitcoins) GetPaymentMethods(ctx context.Context) error

GetPaymentMethods returns a list of valid payment methods. Also contains name and code for payment methods, and possible limitations in currencies and bank name choices.

func (*LocalBitcoins) GetPaymentMethodsByCountry

func (l *LocalBitcoins) GetPaymentMethodsByCountry(ctx context.Context, countryCode string) error

GetPaymentMethodsByCountry returns a list of valid payment methods filtered by countrycodes.

func (*LocalBitcoins) GetPlaces

func (l *LocalBitcoins) GetPlaces(ctx context.Context) error

GetPlaces Looks up places near lat, lon and provides full URLs to buy and sell listings for each. TODO

func (*LocalBitcoins) GetRecentMessages

func (l *LocalBitcoins) GetRecentMessages(ctx context.Context) error

GetRecentMessages returns maximum of 25 newest trade messages. Does not return messages older than one month. Messages are ordered by sending time, and the newest one is first. TODO

func (*LocalBitcoins) GetRecentTrades

func (l *LocalBitcoins) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*LocalBitcoins) GetTicker

func (l *LocalBitcoins) GetTicker(ctx context.Context) (map[string]Ticker, error)

GetTicker returns list of all completed trades.

func (*LocalBitcoins) GetTradableCurrencies

func (l *LocalBitcoins) GetTradableCurrencies(ctx context.Context) ([]string, error)

GetTradableCurrencies returns a list of tradable fiat currencies

func (*LocalBitcoins) GetTradeInfo

func (l *LocalBitcoins) GetTradeInfo(ctx context.Context, contactID string) (dbi DashBoardInfo, err error)

GetTradeInfo returns information about a single trade that the token owner is part in.

func (*LocalBitcoins) GetTrades

func (l *LocalBitcoins) GetTrades(ctx context.Context, currency string, values url.Values) ([]Trade, error)

GetTrades returns all closed trades in online buy and online sell categories, updated every 15 minutes.

func (*LocalBitcoins) GetWalletAddress

func (l *LocalBitcoins) GetWalletAddress(ctx context.Context) (string, error)

GetWalletAddress returns an unused receiving address from the token owner's wallet. The address is returned in the address key of the response. Note that this API may keep returning the same (unused) address if requested repeatedly.

func (*LocalBitcoins) GetWalletBalance

func (l *LocalBitcoins) GetWalletBalance(ctx context.Context) (WalletBalanceInfo, error)

GetWalletBalance Same as GetWalletInfo(), but only returns the message, receiving_address and total fields. Use this instead if you don't care about transactions at the moment.

func (*LocalBitcoins) GetWalletInfo

func (l *LocalBitcoins) GetWalletInfo(ctx context.Context) (WalletInfo, error)

GetWalletInfo gets information about the token owner's wallet balance.

func (*LocalBitcoins) GetWithdrawalsHistory

func (l *LocalBitcoins) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)

GetWithdrawalsHistory returns previous withdrawals data

func (*LocalBitcoins) Getads

func (l *LocalBitcoins) Getads(ctx context.Context, args ...string) (AdData, error)

Getads returns information of single advertisement based on the ad ID, if adID omitted.

adID - [optional] string if omitted returns all ads

func (*LocalBitcoins) InitiateTrade

func (l *LocalBitcoins) InitiateTrade(ctx context.Context, adID string) error

InitiateTrade sttempts to start a Bitcoin trade from the specified advertisement ID. TODO

func (*LocalBitcoins) Logout

func (l *LocalBitcoins) Logout(ctx context.Context) error

Logout expires the current access token immediately. To get a new token afterwards, public apps will need to re-authenticate, confidential apps can turn in a refresh token.

func (*LocalBitcoins) MarkAsPaid

func (l *LocalBitcoins) MarkAsPaid(ctx context.Context, contactID string) error

MarkAsPaid marks a trade as paid.

func (*LocalBitcoins) MarkNotifications

func (l *LocalBitcoins) MarkNotifications(ctx context.Context) error

MarkNotifications marks a specific notification as read. TODO

func (*LocalBitcoins) ModifyOrder

func (l *LocalBitcoins) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*LocalBitcoins) ReleaseFunds

func (l *LocalBitcoins) ReleaseFunds(ctx context.Context, contactID string) error

ReleaseFunds releases Bitcoin trades specified by ID {contact_id}. If the release was successful a message is returned on the data key.

func (*LocalBitcoins) ReleaseFundsByPin

func (l *LocalBitcoins) ReleaseFundsByPin(ctx context.Context, contactID string) error

ReleaseFundsByPin releases Bitcoin trades specified by ID {contact_id}. if the current pincode is provided. If the release was successful a message is returned on the data key. TODO

func (*LocalBitcoins) Run

func (l *LocalBitcoins) Run()

Run implements the LocalBitcoins wrapper

func (*LocalBitcoins) SendAuthenticatedHTTPRequest

func (l *LocalBitcoins) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, params url.Values, result interface{}) (err error)

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to localbitcoins

func (*LocalBitcoins) SendHTTPRequest

func (l *LocalBitcoins) SendHTTPRequest(ctx context.Context, endpoint exchange.URL, path string, result interface{}, ep request.EndpointLimit) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*LocalBitcoins) SendMessage

func (l *LocalBitcoins) SendMessage(ctx context.Context, contactID string) error

SendMessage posts a message and/or uploads an image to the trade. Encode images with multipart/form-data encoding. TODO

func (*LocalBitcoins) SetDefaults

func (l *LocalBitcoins) SetDefaults()

SetDefaults sets the package defaults for localbitcoins

func (*LocalBitcoins) SetFeedback

func (l *LocalBitcoins) SetFeedback(ctx context.Context) error

SetFeedback gives feedback to user. Possible feedback values are: trust, positive, neutral, block, block_without_feedback, (check const values) This is only possible to set if there is a trade between the token owner and the user specified in {username} that is canceled or released. You may also set feedback message using msg field with few exceptions. Feedback block_without_feedback clears the message and with block the message is mandatory.

feedback - string (use const valuesfor feedback) msg - [optional] Feedback message displayed alongside feedback on receivers profile page. username - username of trade contact TODO

func (*LocalBitcoins) Setup

func (l *LocalBitcoins) Setup(exch *config.Exchange) error

Setup sets exchange configuration parameters

func (*LocalBitcoins) Start

func (l *LocalBitcoins) Start(wg *sync.WaitGroup) error

Start starts the LocalBitcoins go routine

func (*LocalBitcoins) SubmitOrder

func (l *LocalBitcoins) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*LocalBitcoins) UpdateAccountInfo

func (l *LocalBitcoins) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the LocalBitcoins exchange

func (*LocalBitcoins) UpdateOrderbook

func (l *LocalBitcoins) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*LocalBitcoins) UpdatePriceEquation

func (l *LocalBitcoins) UpdatePriceEquation(ctx context.Context, adID string) error

UpdatePriceEquation updates price equation of an advertisement. If there are problems with new equation, the price and equation are not updated and advertisement remains visible.

equation - string of equation adID - string of specific ad identification TODO

func (*LocalBitcoins) UpdateTicker

func (l *LocalBitcoins) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*LocalBitcoins) UpdateTickers

func (l *LocalBitcoins) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*LocalBitcoins) UpdateTradablePairs

func (l *LocalBitcoins) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*LocalBitcoins) ValidateCredentials

func (l *LocalBitcoins) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*LocalBitcoins) VerifyIdentity

func (l *LocalBitcoins) VerifyIdentity(ctx context.Context, contactID string) error

VerifyIdentity marks the identity of trade partner as verified. You must be the advertiser in this trade.

func (*LocalBitcoins) VerifyUsername

func (l *LocalBitcoins) VerifyUsername(ctx context.Context) error

VerifyUsername returns list of real name verifiers for the user. Returns a list only when you have a trade with the user where you are the seller.

func (*LocalBitcoins) WalletSend

func (l *LocalBitcoins) WalletSend(ctx context.Context, address string, amount float64, pin int64) error

WalletSend sends amount of bitcoins from the token owner's wallet to address. On success, the response returns a message indicating success. It is highly recommended to minimize the lifetime of access tokens with the money permission. Use Logout() to make the current token expire instantly.

func (*LocalBitcoins) WithdrawCryptocurrencyFunds

func (l *LocalBitcoins) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*LocalBitcoins) WithdrawFiatFunds

func (l *LocalBitcoins) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*LocalBitcoins) WithdrawFiatFundsToInternationalBank

func (l *LocalBitcoins) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

type Message

type Message struct {
	MSG    string `json:"msg"`
	Sender struct {
		ID         int64  `json:"id"`
		Name       string `json:"name"`
		Username   string `json:"username"`
		TradeCount int64  `json:"trafe_count"`
		LastOnline string `json:"last_online"`
	} `json:"sender"`
	CreatedAt      string `json:"created_at"`
	IsAdmin        bool   `json:"is_admin"`
	AttachmentName string `json:"attachment_name"`
	AttachmentType string `json:"attachment_type"`
	AttachmentURL  string `json:"attachment_url"`
}

Message holds the returned message data from a contact

type NotificationInfo

type NotificationInfo struct {
	URL       string `json:"url"`
	CreatedAt string `json:"created_at"`
	ContactID int64  `json:"contact_id"`
	Read      bool   `json:"read"`
	MSG       string `json:"msg"`
	ID        string `json:"id"`
}

NotificationInfo holds Notification data

type Orderbook

type Orderbook struct {
	Bids []Price `json:"bids"`
	Asks []Price `json:"asks"`
}

Orderbook is a full range of bid and asks for localbitcoins

type Price

type Price struct {
	Price  float64
	Amount float64
}

Price is a sub-type for orderbook

type RateLimit

type RateLimit struct {
	Orderbook *rate.Limiter
	Ticker    *rate.Limiter
}

RateLimit define s custom rate limiter scoped for orderbook requests

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

func (r *RateLimit) Limit(f request.EndpointLimit) error

Limit executes rate limiting functionality for Binance

type Ticker

type Ticker struct {
	Avg12h float64 `json:"avg_12h,string"`
	Avg1h  float64 `json:"avg_1h,string,omitempty"`
	Avg6h  float64 `json:"avg_6h,string,omitempty"`
	Avg24h float64 `json:"avg_24h,string"`
	Rates  struct {
		Last float64 `json:"last,string"`
	} `json:"rates"`
	VolumeBTC float64 `json:"volume_btc,string"`
}

Ticker contains ticker information

type Trade

type Trade struct {
	TID    int64   `json:"tid"`
	Date   int64   `json:"date"`
	Amount float64 `json:"amount,string"`
	Price  float64 `json:"price,string"`
}

Trade holds closed trade information

type WalletAddressList

type WalletAddressList struct {
	Address  string  `json:"address"`
	Received float64 `json:"received,string"`
}

WalletAddressList is a sub-type for WalletInfo & WalletBalanceInfo

type WalletBalanceInfo

type WalletBalanceInfo struct {
	Message               string              `json:"message"`
	Total                 Balance             `json:"total"`
	ReceivingAddressCount int                 `json:"receiving_address_count"` // always 1
	ReceivingAddressList  []WalletAddressList `json:"receiving_address_list"`
}

WalletBalanceInfo standard wallet balance information

type WalletInfo

type WalletInfo struct {
	Message                 string              `json:"message"`
	Total                   Balance             `json:"total"`
	SentTransactions30d     []WalletTransaction `json:"sent_transactions_30d"`
	ReceivedTransactions30d []WalletTransaction `json:"received_transactions_30d"`
	ReceivingAddressCount   int                 `json:"receiving_address_count"`
	ReceivingAddressList    []WalletAddressList `json:"receiving_address_list"`
}

WalletInfo holds full wallet information data

type WalletTransaction

type WalletTransaction struct {
	TXID        string    `json:"txid"`
	Amount      float64   `json:"amount,string"`
	Description string    `json:"description"`
	TXType      int       `json:"tx_type"`
	CreatedAt   time.Time `json:"created_at"`
}

WalletTransaction is a sub-type for WalletInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL