def handle(self, *args, **options):
        from custom import good_nodes

        from ob.util import get_exchange_rates, update_price_values, \
            update_verified
        get_exchange_rates()

        qs = Profile.objects.filter(network='mainnet',
                                    online=True).exclude(name='')

        try:
            known_pks = [p['peerID'] for p in qs.values('peerID')]
            for peerID in good_nodes:
                if peerID not in known_pks:
                    logger.debug(peerID)
                    p, profile_created = Profile.objects.get_or_create(
                        pk=peerID)
                    sync_profile(p)

        except ReadTimeout:
            pass
        logger.debug("Successfully bootstraped peers")
        update_verified()
        update_price_values()
        from django.utils.timezone import now
        Profile.objects.filter().update(was_online=now())
 def update_price_values(self):
     peer = "QmcUDmZK8PsPYWw5FRHKNZFjszm2K6e68BQSTpnJYUsML7"
     slug = "openbazaar-decentralize-together-t-shirt"
     l, l_c = Listing.objects.get_or_create(profile_id=peer,
                                            slug=slug,
                                            price=1500,
                                            pricing_currency='USD'
                                            )
     l.price_value = None
     l.save()
     update_price_values()
     l = Listing.objects.get(peerID=peer,
                             slug=slug)
     self.assertTrue(l.price_value > 0.001)
def update_price_values():
    get_exchange_rates()
    sleep(3)
    update_price_values()
Example #4
0
    def handle(self, *args, **options):

        get_exchange_rates()
        update_price_values()