You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bitfinex_wrapper.go
    path of file: ./repos/gocryptotrader/exchanges/bitfinex
    
    the code of the file until where you have to start completion: package bitfinex

import (
	"context"
	"errors"
	"fmt"
	"sort"
	"strconv"
	"strings"
	"time"
	"unicode"

	"github.com/thrasher-corp/gocryptotrader/common"
	"github.com/thrasher-corp/gocryptotrader/common/key"
	"github.com/thrasher-corp/gocryptotrader/config"
	"github.com/thrasher-corp/gocryptotrader/currency"
	exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
	"github.com/thrasher-corp/gocryptotrader/exchanges/account"
	"github.com/t
    
func (b *Bitfinex) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
	if p.IsEmpty() {
		return nil, currency.ErrCurrencyPairEmpty
	}
	if err := b.CurrencyPairs.IsAssetEnabled(assetType); err != nil {
		return nil, err
	}
	o := &orderbook.Base{
		Exchange:         b.Name,
		Pair:             p,
		Asset:            assetType,
		PriceDuplication: true,
		VerifyOrderbook:  b.CanVerifyOrderbook,
	}

	fPair, err := b.FormatExchangeCurrency(p, assetType)
	if err != nil {
		return o, err
	}
	if assetType != asset.Spot && assetType != asset.Margin && assetType != asset.MarginFunding {
		return o, fmt.Errorf("%w %v", asset.ErrNotSupported, assetType)
	}
	b.appendOptionalDelimiter(&fPair)
	var prefix = "t"
	if assetType == asset.MarginFunding {
		prefix = "f"
	}

	orderbookNew, err := b.GetOrderbook(ctx, prefix+fPair.String(), "R0", 100)
	if err != nil {
		return o, err
	}
	if assetType == asset.MarginFunding {
		o.IsFundingRate = true
		o.Asks = make(orderbook.Items, len(orderbookNew.Asks))
		for x := range orderbookNew.Asks {
			o.Asks[x] = orderbook.Item{
				ID:     orderbookNew.Asks[x].OrderID,
				Price:  orderbookNew.Asks[x].Rate,
				Amount: orderbookNew.Asks[x].Amount,
				Period: int64(orderbookNew.Asks[x].Period),
			}
		}
		o.Bids = make(orderbook.Items, len(orderbookNew.Bids))
		for x := range orderbookNew.Bids {
			o.Bids[x] = orderbook.Item{
				ID:     orderbookNew.Bids[x].OrderID,
				Price:  orderbookNew.Bids[x].Rate,
				Amount: orderbookNew.Bids[x].Amount,
				Period: int64(orderbookNew.Bids[x].Period),
			}
		}
	} else {
		o.Asks = make(orderbook.Items, len(orderbookNew.Asks))
		for x := range orderbookNew.Asks {
			o.Asks[x] = orderbook.Item{
				ID:     orderbookNew.Asks[x].OrderID,
				Price:  orderbookNew.Asks[x].Price,
				Amount: orderbookNew.Asks[x].Amount,
			}
		}
		o.Bids = make(orderbook.Items, len(orderbookNew.Bids))
		for x := range orderbookNew.Bids {
			o.Bids[x] = orderbook.Item{
				ID:     orderbookNew.Bids[x].OrderID,
				Price:  orderbookNew.Bids[x].Price,
				Amount: orderbookNew.Bids[x].Amount,
			}
		}
	}
	err = o.Process()
	if err != nil {
		return nil, err
	}
	return orderbook.Get(b.Name, fPair, assetType)
}